Friday, February 7, 2020

Entitty Framework Core - Migrations

To migrate through the package manager console download the Nuget "Microsoft.EntityFrameworkCore.Tools"

The Enable-migration is deprecated in Core, so no need of this command as the migrations are enabled by default.


Adding a migration
Example : Add-Migration MyFirstMigration

Update the database
update-database

To get a SQL script containing all migration snapshots use the below command:
 Script-Migration

For more help on EF Core migrations type in the below command in Package manage console
 Get-Help entityframework

No comments:

Post a Comment