重置实体框架7迁移
问题描述:
我正在使用Entity Framework 7 beta5.我从带有用户管理的mvc模板开始.在试用期间,我添加了几个迁移.
I'm using Entity Framework 7 beta 5. I started with the mvc template with user management. I have added several migrations, during my trials.
现在,我要删除数据库,创建一个新的初始迁移并使用它生成一个新的干净的数据库.
Now I want to delete my database, create a new initial migration and produce a new clean db with it.
但是dnx ef命令没有我所知道的命令,这将有助于实现这一点.我该如何进行?
However the dnx ef commands do not have a command that I know of that will facilitate this. How do I proceed?
答
您到底需要EF支持什么?这就是我要做的:
What exactly do you need support from EF for? Here's what I'd do:
- 删除数据库
- 删除所有迁移
- 配置上下文以指向新的,干净的 数据库
- 运行
dotnet ef migrations add <initial-migration-name>
- Delete your database
- Delete all your migrations
- Configure the context to point to your new, clean database
- Run
dotnet ef migrations add <initial-migration-name>