Migration-添加表(加外键)
添加 Migration
2023-09-27 14:28:06 时间
public partial class _222 : DbMigration { public override void Up() { //DropForeignKey("dbo.Assets", "AssetBorrow_Id", "dbo.AssetBorrows"); //DropIndex("dbo.Assets", new[] { "AssetBorrow_Id" }); CreateTable( "dbo.AssetBorrowSubs", c => new { Id = c.Guid(nullable: false), AssetCode = c.String(), AssetName = c.String(), AssetNum = c.String(), Brand = c.String(), Model = c.String(), AssetId = c.String(), Created = c.DateTime(nullable: false), AssetBorrow_Id = c.Guid(), }) .PrimaryKey(t => t.Id) .ForeignKey("dbo.AssetBorrows", t => t.AssetBorrow_Id) .Index(t => t.AssetBorrow_Id); //DropColumn("dbo.Assets", "AssetBorrow_Id"); } public override void Down() { //AddColumn("dbo.Assets", "AssetBorrow_Id", c => c.Guid()); DropForeignKey("dbo.AssetBorrowSubs", "AssetBorrow_Id", "dbo.AssetBorrows"); DropIndex("dbo.AssetBorrowSubs", new[] { "AssetBorrow_Id" }); DropTable("dbo.AssetBorrowSubs"); // CreateIndex("dbo.Assets", "AssetBorrow_Id"); // AddForeignKey("dbo.Assets", "AssetBorrow_Id", "dbo.AssetBorrows", "Id"); } }
相关文章
- EasyUI中datagrid的行编辑模式中,找到特定的Editor,并为其添加事件
- 如何通过jQuery的css方法添加带有!important标记的样式
- PR2017添加字幕文本或文字水印
- 百度地图API示例之添加定位相关控件
- 如何在博客内添加音乐
- Go语言之Gin框架,实现在web界面添加、删除vsftp用户功能(四)
- 手把手教你如何通过Java给图片添加文字和图片水印
- Vue JS项目 添加TypeScript
- 为字符串添加逆序输出的方法
- 每天的学习经验:SharePoint 2013 定义自己添加的产品清单。Callout菜单项、文档关注、SharePoint服务机端对象模型查询
- Java11(JDK11) 将JavaFX 11运行时添加到Eclipse的方法
- 添加新硬盘并创建文件系统(Vmware 虚拟机)
- cmake中添加-fPIC编译选项方法
- VS2013 在配置中手动添加宏定义
- Android Retrofit2 动态(静态)添加请求头Header
- Windows 10 16251 添加的 api