namespace WePlatform.Migrations { using System; using System.Collections.Generic; using System.Data.Entity.Infrastructure.Annotations; using System.Data.Entity.Migrations; public partial class UpdateEngineModel : DbMigration { public override void Up() { DropForeignKey("dbo.WeModel_Engines", "DeleterUserId", "dbo.Sys_Users"); DropForeignKey("dbo.BehaviorRoleInfoBehaviorInfoes", "BehaviorRoleInfo_Id", "dbo.WeBase_BehaviorRoles"); DropForeignKey("dbo.BehaviorRoleInfoBehaviorInfoes", "BehaviorInfo_Id", "dbo.WeLib_Behaviors"); DropForeignKey("dbo.Sys_UserClaims", "UserId", "dbo.Sys_Users"); DropForeignKey("dbo.Sys_UserLogins", "UserId", "dbo.Sys_Users"); DropForeignKey("dbo.Sys_UserRoles", "UserId", "dbo.Sys_Users"); DropForeignKey("dbo.Sys_RoleClaims", "RoleId", "dbo.Sys_Roles"); DropIndex("dbo.WeModel_Engines", new[] { "IsDeleted" }); DropIndex("dbo.WeModel_Engines", new[] { "DeleterUserId" }); AlterTableAnnotations( "dbo.WeModel_Engines", c => new { Id = c.String(nullable: false, maxLength: 128), EngineName = c.String(maxLength: 50), Version = c.String(maxLength: 50), Description = c.String(maxLength: 500), RunnerClassName = c.String(maxLength: 200), ScoreEvalClassName = c.String(maxLength: 200), Remark = c.String(maxLength: 500), LastModificationTime = c.DateTime(), LastModifierUserId = c.Long(), CreationTime = c.DateTime(nullable: false), CreatorUserId = c.Long(), }, annotations: new Dictionary { { "DynamicFilter_EngineInfo_SoftDelete", new AnnotationValues(oldValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition", newValue: null) }, }); AddForeignKey("dbo.BehaviorRoleInfoBehaviorInfoes", "BehaviorRoleInfo_Id", "dbo.WeBase_BehaviorRoles", "Id"); AddForeignKey("dbo.BehaviorRoleInfoBehaviorInfoes", "BehaviorInfo_Id", "dbo.WeLib_Behaviors", "Id"); AddForeignKey("dbo.Sys_UserClaims", "UserId", "dbo.Sys_Users", "Id"); AddForeignKey("dbo.Sys_UserLogins", "UserId", "dbo.Sys_Users", "Id"); AddForeignKey("dbo.Sys_UserRoles", "UserId", "dbo.Sys_Users", "Id"); AddForeignKey("dbo.Sys_RoleClaims", "RoleId", "dbo.Sys_Roles", "Id"); DropColumn("dbo.WeModel_Engines", "IsDeleted"); DropColumn("dbo.WeModel_Engines", "DeleterUserId"); DropColumn("dbo.WeModel_Engines", "DeletionTime"); } public override void Down() { AddColumn("dbo.WeModel_Engines", "DeletionTime", c => c.DateTime()); AddColumn("dbo.WeModel_Engines", "DeleterUserId", c => c.Long()); AddColumn("dbo.WeModel_Engines", "IsDeleted", c => c.Boolean(nullable: false)); DropForeignKey("dbo.Sys_RoleClaims", "RoleId", "dbo.Sys_Roles"); DropForeignKey("dbo.Sys_UserRoles", "UserId", "dbo.Sys_Users"); DropForeignKey("dbo.Sys_UserLogins", "UserId", "dbo.Sys_Users"); DropForeignKey("dbo.Sys_UserClaims", "UserId", "dbo.Sys_Users"); DropForeignKey("dbo.BehaviorRoleInfoBehaviorInfoes", "BehaviorInfo_Id", "dbo.WeLib_Behaviors"); DropForeignKey("dbo.BehaviorRoleInfoBehaviorInfoes", "BehaviorRoleInfo_Id", "dbo.WeBase_BehaviorRoles"); AlterTableAnnotations( "dbo.WeModel_Engines", c => new { Id = c.String(nullable: false, maxLength: 128), EngineName = c.String(maxLength: 50), Version = c.String(maxLength: 50), Description = c.String(maxLength: 500), RunnerClassName = c.String(maxLength: 200), ScoreEvalClassName = c.String(maxLength: 200), Remark = c.String(maxLength: 500), LastModificationTime = c.DateTime(), LastModifierUserId = c.Long(), CreationTime = c.DateTime(nullable: false), CreatorUserId = c.Long(), }, annotations: new Dictionary { { "DynamicFilter_EngineInfo_SoftDelete", new AnnotationValues(oldValue: null, newValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition") }, }); CreateIndex("dbo.WeModel_Engines", "DeleterUserId"); CreateIndex("dbo.WeModel_Engines", "IsDeleted"); AddForeignKey("dbo.Sys_RoleClaims", "RoleId", "dbo.Sys_Roles", "Id", cascadeDelete: true); AddForeignKey("dbo.Sys_UserRoles", "UserId", "dbo.Sys_Users", "Id", cascadeDelete: true); AddForeignKey("dbo.Sys_UserLogins", "UserId", "dbo.Sys_Users", "Id", cascadeDelete: true); AddForeignKey("dbo.Sys_UserClaims", "UserId", "dbo.Sys_Users", "Id", cascadeDelete: true); AddForeignKey("dbo.BehaviorRoleInfoBehaviorInfoes", "BehaviorInfo_Id", "dbo.WeLib_Behaviors", "Id", cascadeDelete: true); AddForeignKey("dbo.BehaviorRoleInfoBehaviorInfoes", "BehaviorRoleInfo_Id", "dbo.WeBase_BehaviorRoles", "Id", cascadeDelete: true); AddForeignKey("dbo.WeModel_Engines", "DeleterUserId", "dbo.Sys_Users", "Id"); } } }