namespace WePlatform.Migrations { using System; using System.Collections.Generic; using System.Data.Entity.Infrastructure.Annotations; using System.Data.Entity.Migrations; public partial class Updatedatabase : DbMigration { public override void Up() { CreateTable( "dbo.WeBase_ThirdPartySystems", c => new { Id = c.String(nullable: false, maxLength: 128), Name = c.String(maxLength: 50), AppId = c.String(maxLength: 50), SecretKey = c.String(maxLength: 50), Description = c.String(maxLength: 500), IsSystem = c.Boolean(nullable: false), IsActive = c.Boolean(nullable: false), IsRegistered = c.Boolean(nullable: false), ExpiredDate = c.DateTime(), Remark = c.String(maxLength: 500), IsDeleted = c.Boolean(nullable: false), DeleterUserId = c.Long(), DeletionTime = c.DateTime(), LastModificationTime = c.DateTime(), LastModifierUserId = c.Long(), CreationTime = c.DateTime(nullable: false), CreatorUserId = c.Long(), }, annotations: new Dictionary { { "DynamicFilter_ThirdPartySystemInfo_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" }, }) .PrimaryKey(t => t.Id) .ForeignKey("dbo.Sys_Users", t => t.CreatorUserId) .ForeignKey("dbo.Sys_Users", t => t.DeleterUserId) .ForeignKey("dbo.Sys_Users", t => t.LastModifierUserId) .Index(t => t.AppId, unique: true) .Index(t => t.IsDeleted) .Index(t => t.DeleterUserId) .Index(t => t.LastModifierUserId) .Index(t => t.CreatorUserId); AlterTableAnnotations( "dbo.Sys_AttachFiles", c => new { Id = c.Int(nullable: false, identity: true), AttachNo = c.String(maxLength: 32), TableName = c.String(maxLength: 50), ColumnName = c.String(maxLength: 50), SourceKey = c.String(maxLength: 50), FileTitle = c.String(maxLength: 50), FileName = c.String(maxLength: 50), FilePath = c.String(maxLength: 500), FileType = c.String(maxLength: 20), FileExt = c.String(maxLength: 10), Description = c.String(maxLength: 500), TenantId = c.Int(nullable: false), IsDeleted = c.Boolean(nullable: false), DeleterUserId = c.Long(), DeletionTime = c.DateTime(), LastModificationTime = c.DateTime(), LastModifierUserId = c.Long(), CreationTime = c.DateTime(nullable: false), CreatorUserId = c.Long(), }, annotations: new Dictionary { { "DynamicFilter_SysAttachFile_SoftDelete", new AnnotationValues(oldValue: null, newValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition") }, }); AddColumn("dbo.WeLib_Packages", "AssessRoleNames", c => c.String(maxLength: 500)); AddColumn("dbo.WeLib_PackagesXml", "AllRoles", c => c.String()); AddColumn("dbo.Sys_AttachFiles", "IsDeleted", c => c.Boolean(nullable: false)); AddColumn("dbo.Sys_AttachFiles", "DeleterUserId", c => c.Long()); AddColumn("dbo.Sys_AttachFiles", "DeletionTime", c => c.DateTime()); AddColumn("dbo.Sys_AttachFiles", "LastModificationTime", c => c.DateTime()); AddColumn("dbo.Sys_AttachFiles", "LastModifierUserId", c => c.Long()); AlterColumn("dbo.Sys_Functions", "Icon", c => c.String(maxLength: 50)); CreateIndex("dbo.Sys_AttachFiles", "IsDeleted"); CreateIndex("dbo.Sys_AttachFiles", "DeleterUserId"); CreateIndex("dbo.Sys_AttachFiles", "LastModifierUserId"); AddForeignKey("dbo.Sys_AttachFiles", "DeleterUserId", "dbo.Sys_Users", "Id"); AddForeignKey("dbo.Sys_AttachFiles", "LastModifierUserId", "dbo.Sys_Users", "Id"); } public override void Down() { DropForeignKey("dbo.WeBase_ThirdPartySystems", "LastModifierUserId", "dbo.Sys_Users"); DropForeignKey("dbo.WeBase_ThirdPartySystems", "DeleterUserId", "dbo.Sys_Users"); DropForeignKey("dbo.WeBase_ThirdPartySystems", "CreatorUserId", "dbo.Sys_Users"); DropForeignKey("dbo.Sys_AttachFiles", "LastModifierUserId", "dbo.Sys_Users"); DropForeignKey("dbo.Sys_AttachFiles", "DeleterUserId", "dbo.Sys_Users"); DropIndex("dbo.WeBase_ThirdPartySystems", new[] { "CreatorUserId" }); DropIndex("dbo.WeBase_ThirdPartySystems", new[] { "LastModifierUserId" }); DropIndex("dbo.WeBase_ThirdPartySystems", new[] { "DeleterUserId" }); DropIndex("dbo.WeBase_ThirdPartySystems", new[] { "IsDeleted" }); DropIndex("dbo.WeBase_ThirdPartySystems", new[] { "AppId" }); DropIndex("dbo.Sys_AttachFiles", new[] { "LastModifierUserId" }); DropIndex("dbo.Sys_AttachFiles", new[] { "DeleterUserId" }); DropIndex("dbo.Sys_AttachFiles", new[] { "IsDeleted" }); AlterColumn("dbo.Sys_Functions", "Icon", c => c.String(maxLength: 20)); DropColumn("dbo.Sys_AttachFiles", "LastModifierUserId"); DropColumn("dbo.Sys_AttachFiles", "LastModificationTime"); DropColumn("dbo.Sys_AttachFiles", "DeletionTime"); DropColumn("dbo.Sys_AttachFiles", "DeleterUserId"); DropColumn("dbo.Sys_AttachFiles", "IsDeleted"); DropColumn("dbo.WeLib_PackagesXml", "AllRoles"); DropColumn("dbo.WeLib_Packages", "AssessRoleNames"); AlterTableAnnotations( "dbo.Sys_AttachFiles", c => new { Id = c.Int(nullable: false, identity: true), AttachNo = c.String(maxLength: 32), TableName = c.String(maxLength: 50), ColumnName = c.String(maxLength: 50), SourceKey = c.String(maxLength: 50), FileTitle = c.String(maxLength: 50), FileName = c.String(maxLength: 50), FilePath = c.String(maxLength: 500), FileType = c.String(maxLength: 20), FileExt = c.String(maxLength: 10), Description = c.String(maxLength: 500), TenantId = c.Int(nullable: false), IsDeleted = c.Boolean(nullable: false), DeleterUserId = c.Long(), DeletionTime = c.DateTime(), LastModificationTime = c.DateTime(), LastModifierUserId = c.Long(), CreationTime = c.DateTime(nullable: false), CreatorUserId = c.Long(), }, annotations: new Dictionary { { "DynamicFilter_SysAttachFile_SoftDelete", new AnnotationValues(oldValue: "EntityFramework.DynamicFilters.DynamicFilterDefinition", newValue: null) }, }); DropTable("dbo.WeBase_ThirdPartySystems", removedAnnotations: new Dictionary { { "DynamicFilter_ThirdPartySystemInfo_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" }, }); } } }