Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to revert EF Core migration from SQL Server 2016 production machine

I have to revert the last EF Core migration from a productive instance from a SQL Server 2016 with no Visual Studio installed. How to do this?

Note: I already tried to install .NET SDK on the server but nevertheless it does not know the command dotnet ef. Executing the command results in No executable found matching command "dotnet-ef"

like image 219
MDummy Avatar asked Nov 02 '25 17:11

MDummy


1 Answers

You can generate the SQL script to revert a migration using the Script-Migration or dotnet ef migrations script command.

dotnet ef migrations script TheAppliedMigration TheMigrationBeforeIt -o revert.sql
like image 169
bricelam Avatar answered Nov 04 '25 09:11

bricelam



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!