Skip to main content

Applying Migrations

Basic Usage

  1. Generate script for migration
dotnet ef migrations script
  1. Generate script from given migration to the last migration
dotnet ef migrations script AddNewMigration
  1. Generate script from specific from migration to to migration
dotnet ef migrations script AddNewMigration AddAnotherMigration

Idemotent SQL Script

dotnet ef migrations script --idempotent

Command-Line Tools(Not for Production)

  1. update database to the latest migration
dotnet ef database update
  1. update database to a specific migration
dotnet ef database update AddNewMigration

Bundles

  1. Generate Bundle
dotnet ef migrations bundle
  1. Generate Self-contained Bundle for Linux
dotnet ef migrations bundle --self-contained -r linux-x64