oclockvn / oclockvn.github.io

My personal blog
https://oclockvn.github.io/
0 stars 1 forks source link

migration #29

Open oclockvn opened 4 years ago

oclockvn commented 4 years ago
# dotnet tool
dotnet ef migrations script 20200226024902_GenerateNextMigrationScript -o output.sql

# package manager console
Script-Migration -From <PreviousMigration> -To <LastMigration>
oclockvn commented 4 years ago

Remove a migration

Sometimes you add a migration and realize you need to make additional changes to your EF Core model before applying it. To remove the last migration, use this command.

Remove-Migration

Revert a migration

If you already applied a migration (or several migrations) to the database but need to revert it, you can use the same command to apply migrations, but specify the name of the migration you want to roll back to.

Update-Database LastGoodMigration