I have an initial migration which has run successfully, however, when I try to add a new one I'm told I cant because the migration is pending:
PM> Update-Database -TargetMigration 201511051706498_InitialCreate -ConfigurationTypeName MyConfiguration -ConnectionString "__My_Connection_String__" cmdlet Update-Database at command pipeline position 1 Supply values for the following parameters: ConnectionProviderName: System.Data.SqlClient Specify the '-Verbose' flag to view the SQL statements being applied to the target database. Applying explicit migrations: [201511051706498_InitialCreate]. Applying explicit migration: 201511051706498_InitialCreate. PM> Add-Migration -ConfigurationTypeName MyConfiguration cmdlet Add-Migration at command pipeline position 1 Supply values for the following parameters: Name: InitialCorrectLedgeringColumns Unable to generate an explicit migration because the following explicit migrations are pending: [201511051706498_InitialCreate]. Apply the pending explicit migrations before attempting to generate a new explicit migration.
I can see the migration in the database
SELECT [MigrationId] FROM [localacount].[dbo].[__MigrationHistory]
MigrationId ---------------------------------- 201511051706498_InitialCreate (1 row(s) affected)
What's going on here? Why can't I add the next migration?
Make sure you're targeting the right database and verify your connection string.
Update-Database command you have explicitly overridden the connection string, but haven't specified one for
Add-Migration. The latter would then be using the default connection string from your context - presumably a different database.