The problem is that you have a migration that for some reason is referencing a constraint that has either not been created or deleted.
To solve this
- Check your migration history table on your database (
_EFMigrationsHistory) to know the last successful migration.Check your migration history table on your database (
_EFMigrationsHistory) to know the last successful migration. - Go to the migrations folder in your solution and check for the migration added after the last successful migration.
Go to the migrations folder in your solution and check for the migration added after the last successful migration.
- The error is most like from a statement that is trying to drop the
FK_ApplicationUserToken_AspNetUsers_UserId, usually written like:The error is most like from a statement that is trying to drop the
FK_ApplicationUserToken_AspNetUsers_UserId, usually written like:migrationBuilder.DropForeignKey( name: "FK_ApplicationUserToken_AspNetUsers_UserId", table: "Your table")
You can either comment this statement or delete it
Try to update your database again
migrationBuilder.DropForeignKey( name: "FK_ApplicationUserToken_AspNetUsers_UserId", table: "Your table")
- You can either comment this statement or delete it
- Try to update your database again