Migration-添加表(加外键)
2024-09-06 16:45:51
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");
}
}
最新文章
- UESTC 1237 质因子分解
- JS事件冒泡与捕获
- CodeForces 732D Exams (二分)
- Spark小课堂Week5 Scala初探
- 在jsp中运用ajax实现同一界面不跳转处理事件
- 一个简单的makefile,一次性编译本文件夹下所有的cpp文件
- Delphi如何让程序最小化到任务栏(截取WM_SYSCOMMAND后,调用Shell_NotifyIcon)
- js的兼容性问题
- [Javascript] The JSON.stringify API
- Thrift官方安装手冊(译)
- java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
- grunt之filerev、usemin
- C++ STL常用容器基本用法汇总
- C++求集合的交集差集
- Network Policy - 每天5分钟玩转 Docker 容器技术(171)
- Windows7下安装、部署Weblogic和发布war项目
- matlab练习程序(加权最小二乘)
- java内嵌jetty服务器
- CPU指令分类
- pymysql 数据库操控