To find out which migrations were applied to the database, use the Get-Migrations
command:
Get-Migrations -ConnectionStringName PROD
You can also check the contents of the __MigrationsHistory
table in the right database. It contains information about all migrations applied to the database.
The following migration used depends on the existing migration files in your project. The migration file name includes a prefix, which is a timestamp that defines the time at which the migration file was generated (if you did not use the -force
, which can result in reuse of an existing migration file that retains the existing timestamp string). Migrations apply according to this timestamp. Thus, the alphabetical order of your migration files indicates the order in which they are applied.
A safe way to check which migration will be applied next is to run Update-Database
with the -Script
, which generates an SQL script for the migration, but does not run it. Thus, you can see what migration will be applied if you run the real Update-Database
.
source share