Home > other >  Update script for SQL
Update script for SQL

Time:05-20

I have a Blazor app that I used the following command to create the database.

dotnet ef migrations script

The problem is the script generated is only good for a first time database with nothing in it. Is there a command I can run to generate an update script?

CodePudding user response:

update your database

  • dotnet ef database update

CodePudding user response:

The whole migrations mechanism in EF is about keeping consistency between your data model and according db schema. Each time your data model changes you should generate new migration.

Think of migrations as of deltas, containing information of what was added and removed from particular tables in your database. It gets pretty clear if you look inside a generated migration class. There are EF related methods providing a layer of abstraction over SQL modifications on databse. Migrations overview

  • Related