Entity Framework - Start Over - Undo/Rollback All Migrations

后端 未结 5 648
忘了有多久
忘了有多久 2020-12-12 09:18

For some reason, my migrations appear to have been jumbled/corrupted/whatever. I\'m at the point where I just want to start over, so is there a way to completely undo all m

5条回答
  •  半阙折子戏
    2020-12-12 09:45

    You can rollback to any migration by using:

    Update-Database -TargetMigration:"MigrationName"
    

    If you want to rollback all migrations you can use:

    Update-Database -TargetMigration:0
    

    or equivalent:

    Update-Database -TargetMigration:$InitialDatabase 
    

    In some cases you can also delete database and all migration classes.

提交回复
热议问题