Tag: database migration

EF迁移:回滚上次应用的迁移?

这看起来像一个非常常见的任务,但我找不到一个简单的方法来做到这一点。 我想撤消上次应用的迁移。 我会期待一个简单的命令,比如 PM> Update-Database -TargetMigration:"-1" 相反,我所能想到的是: PM> Get-Migrations Retrieving migrations that have been applied to the target database. 201208012131302_Add-SystemCategory 201207311827468_CategoryIdIsLong 201207232247409_AutomaticMigration 201207211340509_AutomaticMigration 201207200025294_InitialCreate PM> Update-Database -TargetMigration:"CategoryIdIsLong" (至less我可以使用名字,跳过时间戳…) 有更容易的方法吗?