Home > Blockchain >  EFCore run single migration
EFCore run single migration

Time:11-26

the migration table in the database is non existant so I am trying to run 1 specific migration that didnt run yet. I tried using the -target and -migration flag but those do not seem to exist.

I am now trying the -SourceMigration flag without result.

Update-Database -SourceMigration 202107031357360_LoginTokens

the Applying code-based migrations: output keeps on showing that it wants to run the full list of migrations

CodePudding user response:

the Applying code-based migrations: output keeps on showing that it wants to run the full list of migrations

... Because according to your __MigrationHistory table, none of the existing migrations have been applied. Migrations are like a stack, you can't just run a random migration in the middle, you have to start from the bottom.

If your database already exists and can't be recreated, you can manually insert the records for migrations that you know were applied. You could for example copy the structure and contents from your development database.

Then you can update to the desired migration.

  • Related