EF Migrations: Rollback last applied migration?

后端 未结 15 1237
终归单人心
终归单人心 2020-12-02 03:39

This looks like a really common task, but I can\'t find an easy way to do it.

I want to undo the last applied migration. I would have expected a simple command, lik

15条回答
  •  广开言路
    2020-12-02 04:17

    I'm using EntityFrameworkCore and I use the answer by @MaciejLisCK. If you have multiple DB contexts you will also need to specify the context by adding the context parameter e.g. :

    Update-Database 201207211340509_MyMigration -context myDBcontext

    (where 201207211340509_MyMigration is the migration you want to roll back to, and myDBcontext is the name of your DB context)

提交回复
热议问题