So far, we applied all migrations using Visual Studio. This works really well when developers are working on features inside Visual Studio. However, when it comes to updating, testing, or production environments, this approach does not really work.
In order to update such software installations, we are given more options, which are as follows:
Generate the changes script
Use
migrate.exe
Use the migrating initializer
We can easily generate a script by running the Update-Database
commandlet with the Script
parameter inside the same Package Manager Console window, using the following code line:
Update-Database -Script
As soon as this commandlet completes, the generated script will be opened. It will contain all the required changes to bring the structure of the target database up to date. We just need to give this script to our DBA, who will maintain our production environment.