【Entity Framework】Revert the database to specified migration.
本文涉及的相关问题,如果你的问题或需求有与下面所述相似之处,请阅读本文
[Entity Framework] Revert the database to specified migration.
[Entity Framework] Re-scaffold migration file.
对于初期没有设计好Model的情况下, 已经add的migration并且已经update到db中之后可以通过下列命令达到重新编辑之前add的migration, 并且不会为你的项目新增migration文件.
比如我的项目已经有如下migration结构:

其中对于201901170814382_AddSlotManagement的migration,由于model模型变了我希望重新生成关于这个功能的migration.
首先将migration revert回到上一个migration
PM> Update-Database -TargetMigration 201901160836219_AddRelevanceModels
Specify the '-Verbose' flag to view the SQL statements being applied to the target database.
Reverting migrations: [201901170814382_AddSlotManagement].
Reverting explicit migration: 201901170814382_AddSlotManagement.
然后重新执行add migration.记住名字一致和加上-Force参数
PM> Add-Migration 201901170814382_AddSlotManagement
Re-scaffolding migration '201901170814382_AddSlotManagement'.
Only the Designer Code for migration '201901170814382_AddSlotManagement' was re-scaffolded. To re-scaffold the entire migration, use the -Force parameter.
PM> Add-Migration 201901170814382_AddSlotManagement -Force
Re-scaffolding migration '201901170814382_AddSlotManagement'.
希望以上内容能够帮助到遇到同样问题的你.如有其它思路可以随时联系我.

【Entity Framework】Revert the database to specified migration.的更多相关文章
- 【Entity Framework】 Entity Framework资料汇总
Fluent API : http://social.msdn.microsoft.com/Search/zh-CN?query=Fluent%20API&Refinement=95& ...
- 【Entity Framework】disable automatic migration, 执行update-migration仍然会显示有automatic migration
本文涉及的相关问题,如果你的问题或需求有与下面所述相似之处,请阅读本文 [Entity Framework] disable automatic migration, 执行update-migrati ...
- 【Entity Framework】初级篇--ObjectContext、ObjectQuery、ObjectStateEntry、ObjectStateManager类的介绍
本节,简单的介绍EF中的ObjectContext.ObjectQuery.ObjectStateEntry.ObjectStateManager这个几个比较重要的类,它们都位于System.Data ...
- 【Entity Framework】Model First Approach
EF中的model first 所谓mf, 就是使用vs提供的edm designer去设计model,然后将设计好的model使用vs在指定的数据库中生成数据库即可. 当你的项目既没有数据库也没有c ...
- 【Entity framework】Code First Approach
开篇之前感谢 china_fucan的文章给我的帮助,下面的评论也解决了很多问题同样给予感谢. code first 项目中的ORM框架如果采用的是EF,那么可能会采用code first的方式去使用 ...
- EF是啥?【What is Entity Framework?】(EF基础系列2)
EF产生的背景: 编写ADO.NET访问数据的代码,是沉闷而枯燥的,所以微软提供了一个对象关系映射框架(我们称之为EF),通过EF可以自动帮助我们的程序自动生成相关数据库. Writing and m ...
- EF框架组件详述【Entity Framework Architecture】(EF基础系列篇3)
我们来看看EF的框架设计吧: The following figure shows the overall architecture of the Entity Framework. Let us n ...
- 【Basics of Entity Framework】【EF基础系列1】
EF自己包括看视频,看MSDN零零散散的学了一点皮毛,这次打算系统学习一下EF.我将会使用VS2012来学习这个EF基础系列. 现在看看EF的历史吧: EF版本 相关版本特性介绍 EF3.5 基于数据 ...
- 实体之间的关系【Entity Relationships】(EF基础系列篇9)
Here, you will learn how entity framework manages the relationships between entities. Entity framewo ...
随机推荐
- hibernate的面试总结
hibenate的面试总结. 可能现在大家常常还会遇到一个些面试的时候问一些关于hibernate的问题,我个人觉得,这些东西一般做过开发的人在使用上没有任何的问题的,但是如果是要你来说就不一定能够说 ...
- git 回滚指定行
Stage the parts you want with git add -p, then discard (git checkout -- filename) the unstaged chang ...
- Could not find or load main class org.apache.spark.deploy.yarn.ApplicationMaster
Spark YARN Cluster mode get this error "Could not find or load main class org.apache.spark.depl ...
- Tomcat启动时卡在 INFO HostConfig.deployDirectory Deploy
今天在服务器上部署网站时 启动tomcat无错 tail -f catalina.out日志 和 catalina.sh run 方式启动时 卡在 22-Jul-2016 23:00:53.921 I ...
- 剑指offer——python【第44题】翻转单词顺序
题目描述 牛客最近来了一个新员工Fish,每天早晨总是会拿着一本英文杂志,写些句子在本子上.同事Cat对Fish写的内容颇感兴趣,有一天他向Fish借来翻看,但却读不懂它的意思.例如,“student ...
- Python学习之旅(三十二)
Python基础知识(31):图形界面(Ⅱ) Python内置了turtle库,可以在计算机上绘图 运动控制: 1.画笔定位到坐标(x,y):turtle.goto(x,y) 2.向正方向运动 dis ...
- python全栈开发 * 29知识点汇总 * 180712
29 正则表达式 re模块一.正则表达式官方定义:正则表达式是对字符串操作的一种逻辑公式,就是用事先定义好的一些特定字符.及这些特定字符的组合,组成一个“规则字符串”, 这个“规则字符串”用来表达对字 ...
- JavaScript 世界万物诞生记
一. 无中生有 起初,什么都没有.造物主说:没有东西本身也是一种东西啊,于是就有了null: 现在我们要造点儿东西出来.但是没有原料怎么办?有一个声音说:不是有null嘛?另一个声音说:可是null代 ...
- etcd集群的搭建
由于最近在学习kubernetes,etcd作为kubernetes集群的主数据库,必须先启动. etcds实例名称 IP地址 Hostname etcd 1 192.168.142.161 kube ...
- 使用js对WGS-84 ,GCJ-02与BD-09的坐标进行转换
获取到经纬度在用百度地图进行定位时,却发现行驶轨迹的路线定到海里面去了.从网上查阅,知道此方法. 出处:https://www.jianshu.com/p/53f00ba897f7 一.在进行地图开发 ...