Using Migrations in a Production Database

Overview

Previously, we updated the database from the migration files using the dotnet ef database update command. This practice is convenient in a development environment but not in a production environment. In a production environment, the recommended approach is to generate SQL scripts. Using SQL scripts allows us to inspect migrations before deploying them to a production database.

In this lesson, we’ll review some ways to generate SQL scripts.

Note: The commands in this lesson generate code and files. Through the terminal, we can navigate to these files by using relevant Linux commands such as ls to view a list of files & directories, cd to change directories, and cat to view file contents. A SPA widget showing the updated project with the generated files is also available.

SQL scripts

The SQL scripts are made up of a set of SQL commands that describe a database operation.

Get hands-on with 1400+ tech skills courses.