namespace WeApp.Migrations { using System; using System.Collections.Generic; using System.Data.Entity.Infrastructure.Annotations; using System.Data.Entity.Migrations; public partial class Update20220412001 : DbMigration { public override void Up() { CreateTable( "dbo.Train_CampHelps", c => new { Id = c.Int(nullable: false, identity: true), HelpNo = c.String(), CampNo = c.String(maxLength: 128), CreationTime = c.DateTime(nullable: false), CreatorUserId = c.Long(), }) .PrimaryKey(t => t.Id) .ForeignKey("dbo.Train_Camps", t => t.CampNo) .ForeignKey("dbo.Sys_Users", t => t.CreatorUserId) .Index(t => t.CampNo) .Index(t => t.CreatorUserId); CreateTable( "dbo.Bs_PhoneQuestionAnswers", c => new { Id = c.Int(nullable: false, identity: true), Content = c.String(maxLength: 200), Keywords = c.String(maxLength: 100), Type = c.Int(nullable: false), QuestionNo = c.String(maxLength: 128), 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_PhoneAnswerInfo_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) .ForeignKey("dbo.Bs_PhoneQuestions", t => t.QuestionNo) .Index(t => t.QuestionNo) .Index(t => t.IsDeleted) .Index(t => t.DeleterUserId) .Index(t => t.LastModifierUserId) .Index(t => t.CreatorUserId); CreateTable( "dbo.Bs_PhoneQuestions", c => new { Id = c.String(nullable: false, maxLength: 128), Name = c.String(maxLength: 50), Content = c.String(maxLength: 200), Type = c.Int(nullable: false), Tag = c.String(maxLength: 200), 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_PhoneQuestionInfo_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.IsDeleted) .Index(t => t.DeleterUserId) .Index(t => t.LastModifierUserId) .Index(t => t.CreatorUserId); CreateTable( "dbo.Bs_StudentHelps", c => new { Id = c.String(nullable: false, maxLength: 128), HelpName = c.String(maxLength: 50), HelpContent = c.String(maxLength: 200), 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_StudentHelpInfo_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.IsDeleted) .Index(t => t.DeleterUserId) .Index(t => t.LastModifierUserId) .Index(t => t.CreatorUserId); AddColumn("dbo.Train_Camps", "MaxRoundMinute", c => c.Decimal(nullable: false, precision: 18, scale: 2)); AddColumn("dbo.Train_CampSceneMaps", "PhoneQuestionNo", c => c.String()); AddColumn("dbo.Train_CampGroupScores", "Scores", c => c.String()); CreateIndex("dbo.Sys_Settings", "TenantId"); CreateIndex("dbo.Sys_Settings", "UserId"); } public override void Down() { DropForeignKey("dbo.Bs_StudentHelps", "LastModifierUserId", "dbo.Sys_Users"); DropForeignKey("dbo.Bs_StudentHelps", "DeleterUserId", "dbo.Sys_Users"); DropForeignKey("dbo.Bs_StudentHelps", "CreatorUserId", "dbo.Sys_Users"); DropForeignKey("dbo.Bs_PhoneQuestionAnswers", "QuestionNo", "dbo.Bs_PhoneQuestions"); DropForeignKey("dbo.Bs_PhoneQuestions", "LastModifierUserId", "dbo.Sys_Users"); DropForeignKey("dbo.Bs_PhoneQuestions", "DeleterUserId", "dbo.Sys_Users"); DropForeignKey("dbo.Bs_PhoneQuestions", "CreatorUserId", "dbo.Sys_Users"); DropForeignKey("dbo.Bs_PhoneQuestionAnswers", "LastModifierUserId", "dbo.Sys_Users"); DropForeignKey("dbo.Bs_PhoneQuestionAnswers", "DeleterUserId", "dbo.Sys_Users"); DropForeignKey("dbo.Bs_PhoneQuestionAnswers", "CreatorUserId", "dbo.Sys_Users"); DropForeignKey("dbo.Train_CampHelps", "CreatorUserId", "dbo.Sys_Users"); DropForeignKey("dbo.Train_CampHelps", "CampNo", "dbo.Train_Camps"); DropIndex("dbo.Bs_StudentHelps", new[] { "CreatorUserId" }); DropIndex("dbo.Bs_StudentHelps", new[] { "LastModifierUserId" }); DropIndex("dbo.Bs_StudentHelps", new[] { "DeleterUserId" }); DropIndex("dbo.Bs_StudentHelps", new[] { "IsDeleted" }); DropIndex("dbo.Bs_PhoneQuestions", new[] { "CreatorUserId" }); DropIndex("dbo.Bs_PhoneQuestions", new[] { "LastModifierUserId" }); DropIndex("dbo.Bs_PhoneQuestions", new[] { "DeleterUserId" }); DropIndex("dbo.Bs_PhoneQuestions", new[] { "IsDeleted" }); DropIndex("dbo.Bs_PhoneQuestionAnswers", new[] { "CreatorUserId" }); DropIndex("dbo.Bs_PhoneQuestionAnswers", new[] { "LastModifierUserId" }); DropIndex("dbo.Bs_PhoneQuestionAnswers", new[] { "DeleterUserId" }); DropIndex("dbo.Bs_PhoneQuestionAnswers", new[] { "IsDeleted" }); DropIndex("dbo.Bs_PhoneQuestionAnswers", new[] { "QuestionNo" }); DropIndex("dbo.Train_CampHelps", new[] { "CreatorUserId" }); DropIndex("dbo.Train_CampHelps", new[] { "CampNo" }); DropIndex("dbo.Sys_Settings", new[] { "UserId" }); DropIndex("dbo.Sys_Settings", new[] { "TenantId" }); DropColumn("dbo.Train_CampGroupScores", "Scores"); DropColumn("dbo.Train_CampSceneMaps", "PhoneQuestionNo"); DropColumn("dbo.Train_Camps", "MaxRoundMinute"); DropTable("dbo.Bs_StudentHelps", removedAnnotations: new Dictionary { { "DynamicFilter_StudentHelpInfo_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" }, }); DropTable("dbo.Bs_PhoneQuestions", removedAnnotations: new Dictionary { { "DynamicFilter_PhoneQuestionInfo_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" }, }); DropTable("dbo.Bs_PhoneQuestionAnswers", removedAnnotations: new Dictionary { { "DynamicFilter_PhoneAnswerInfo_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" }, }); DropTable("dbo.Train_CampHelps"); } } }