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 __MigrationHistory
table:
SELECT [MigrationId] FROM [localacount].[dbo].[__MigrationHistory]
Gives:
MigrationId
----------------------------------
201511051706498_InitialCreate
(1 row(s) affected)
What's going on here? Why can't I add the next migration?
Update-Database
command you're explicitly specifying a connection string but inAdd-Migration
you're using the default connection string from the context?