'How to move EF migration and update database in Azure SQL DB

I have an Entity framework project created in Visual Studio 2019. I have created a migration using Add-migration, and have updated the local SQL DB using Update-database. The changes in migration are reflected in (localdb)\MSSQLLocalDB. Everything is working as it should.

Now I want to publish my application from VS, and want the changes in my migration and local DB to move/migrate to the Azure SQL DB for use by masses.

How do I make sure after publishing, the changes have migrated to the Azure SQL DB? Thanks, KB



Solution 1:[1]

If you have access to azure database from your local just do Update-Database with azure database connection string. otherwise, you should do this somewhere in your application:

yourDbContext.Database.Migrate();

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Saeed Esmaeelinejad