Search code examples
.netsql-servermigration.net-6.0

.NET Core 6 Update-database on server after migration on local machine


After releasing my application to the server, I like now to make some update on my database (on the server).

In my application I'm using DbContext (IIdentitycore) then with Nuget manager console generate migration then make update-database, so the database in local is updated.

But now how to apply this update to my database on the server? Is there any why to generate an update SQL query?

I'm using .NET 6 and SQL Server Express.

Thank you


Solution

  • You can generate migration scripts using Powershell or CLI commands:

    Script-Migration
    
    dotnet ef migrations script
    

    Or by generating bundle executable file or just applying migrations at runtime at the start of the app.