Search code examples
c#sqlentity-frameworkentity-framework-6entity-framework-migrations

How to migrate Code First changes to production


I've been going through some tutorials and was comfortable with Entity Framework 6.xx where I created database tables, changes etc using migrations.

I deployed the database and then made more changes to local database by adding more tables, renaming columns etc.

How do I upload these changes for the database hosted on the production server?

So far I've been using database scripts and using database comparison tools but I feel I may be missing a trick if it can be easily done in a development environment by a couple of commands?


Solution

  • The recommended way to deploy migrations to a production database is by generating SQL scripts.

    In EF Core: Applying Migrations or EF 6

    Or use for EF Core use Bundles.