namespace WePlatform.Migrations { using System; using System.Data.Entity.Migrations; public partial class Update427002 : DbMigration { public override void Up() { DropForeignKey("dbo.BehaviorRoleInfoBehaviorInfoes", "BehaviorRoleInfo_Id", "dbo.WeBase_BehaviorRoles"); DropForeignKey("dbo.BehaviorRoleInfoBehaviorInfoes", "BehaviorInfo_Id", "dbo.WeLib_Behaviors"); DropIndex("dbo.BehaviorRoleInfoBehaviorInfoes", new[] { "BehaviorRoleInfo_Id" }); DropIndex("dbo.BehaviorRoleInfoBehaviorInfoes", new[] { "BehaviorInfo_Id" }); CreateTable( "dbo.WeLib_BehaviorRelateRoles", c => new { Id = c.Int(nullable: false, identity: true), RoleNo = c.String(maxLength: 128), BehaviorNo = c.String(maxLength: 128), CreationTime = c.DateTime(nullable: false), CreatorUserId = c.Long(), }) .PrimaryKey(t => t.Id) .ForeignKey("dbo.WeLib_Behaviors", t => t.BehaviorNo) .ForeignKey("dbo.Sys_Users", t => t.CreatorUserId) .ForeignKey("dbo.WeBase_BehaviorRoles", t => t.RoleNo) .Index(t => t.RoleNo) .Index(t => t.BehaviorNo) .Index(t => t.CreatorUserId); AddColumn("dbo.WeLib_Behaviors", "BehaviorName", c => c.String(maxLength: 50)); DropTable("dbo.BehaviorRoleInfoBehaviorInfoes"); } public override void Down() { CreateTable( "dbo.BehaviorRoleInfoBehaviorInfoes", c => new { BehaviorRoleInfo_Id = c.String(nullable: false, maxLength: 128), BehaviorInfo_Id = c.String(nullable: false, maxLength: 128), }) .PrimaryKey(t => new { t.BehaviorRoleInfo_Id, t.BehaviorInfo_Id }); DropForeignKey("dbo.WeLib_BehaviorRelateRoles", "RoleNo", "dbo.WeBase_BehaviorRoles"); DropForeignKey("dbo.WeLib_BehaviorRelateRoles", "CreatorUserId", "dbo.Sys_Users"); DropForeignKey("dbo.WeLib_BehaviorRelateRoles", "BehaviorNo", "dbo.WeLib_Behaviors"); DropIndex("dbo.WeLib_BehaviorRelateRoles", new[] { "CreatorUserId" }); DropIndex("dbo.WeLib_BehaviorRelateRoles", new[] { "BehaviorNo" }); DropIndex("dbo.WeLib_BehaviorRelateRoles", new[] { "RoleNo" }); DropColumn("dbo.WeLib_Behaviors", "BehaviorName"); DropTable("dbo.WeLib_BehaviorRelateRoles"); CreateIndex("dbo.BehaviorRoleInfoBehaviorInfoes", "BehaviorInfo_Id"); CreateIndex("dbo.BehaviorRoleInfoBehaviorInfoes", "BehaviorRoleInfo_Id"); AddForeignKey("dbo.BehaviorRoleInfoBehaviorInfoes", "BehaviorInfo_Id", "dbo.WeLib_Behaviors", "Id"); AddForeignKey("dbo.BehaviorRoleInfoBehaviorInfoes", "BehaviorRoleInfo_Id", "dbo.WeBase_BehaviorRoles", "Id"); } } }