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

ef-core-2.0 entity-framework-core sql-server

Question

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"

1
2
2/8/2018 11:54:02 AM

Accepted Answer

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
3
2/8/2018 5:41:41 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow