202204121107076_Update20220412001.cs 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. namespace WeApp.Migrations
  2. {
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Data.Entity.Infrastructure.Annotations;
  6. using System.Data.Entity.Migrations;
  7. public partial class Update20220412001 : DbMigration
  8. {
  9. public override void Up()
  10. {
  11. CreateTable(
  12. "dbo.Train_CampHelps",
  13. c => new
  14. {
  15. Id = c.Int(nullable: false, identity: true),
  16. HelpNo = c.String(),
  17. CampNo = c.String(maxLength: 128),
  18. CreationTime = c.DateTime(nullable: false),
  19. CreatorUserId = c.Long(),
  20. })
  21. .PrimaryKey(t => t.Id)
  22. .ForeignKey("dbo.Train_Camps", t => t.CampNo)
  23. .ForeignKey("dbo.Sys_Users", t => t.CreatorUserId)
  24. .Index(t => t.CampNo)
  25. .Index(t => t.CreatorUserId);
  26. CreateTable(
  27. "dbo.Bs_PhoneQuestionAnswers",
  28. c => new
  29. {
  30. Id = c.Int(nullable: false, identity: true),
  31. Content = c.String(maxLength: 200),
  32. Keywords = c.String(maxLength: 100),
  33. Type = c.Int(nullable: false),
  34. QuestionNo = c.String(maxLength: 128),
  35. IsDeleted = c.Boolean(nullable: false),
  36. DeleterUserId = c.Long(),
  37. DeletionTime = c.DateTime(),
  38. LastModificationTime = c.DateTime(),
  39. LastModifierUserId = c.Long(),
  40. CreationTime = c.DateTime(nullable: false),
  41. CreatorUserId = c.Long(),
  42. },
  43. annotations: new Dictionary<string, object>
  44. {
  45. { "DynamicFilter_PhoneAnswerInfo_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
  46. })
  47. .PrimaryKey(t => t.Id)
  48. .ForeignKey("dbo.Sys_Users", t => t.CreatorUserId)
  49. .ForeignKey("dbo.Sys_Users", t => t.DeleterUserId)
  50. .ForeignKey("dbo.Sys_Users", t => t.LastModifierUserId)
  51. .ForeignKey("dbo.Bs_PhoneQuestions", t => t.QuestionNo)
  52. .Index(t => t.QuestionNo)
  53. .Index(t => t.IsDeleted)
  54. .Index(t => t.DeleterUserId)
  55. .Index(t => t.LastModifierUserId)
  56. .Index(t => t.CreatorUserId);
  57. CreateTable(
  58. "dbo.Bs_PhoneQuestions",
  59. c => new
  60. {
  61. Id = c.String(nullable: false, maxLength: 128),
  62. Name = c.String(maxLength: 50),
  63. Content = c.String(maxLength: 200),
  64. Type = c.Int(nullable: false),
  65. Tag = c.String(maxLength: 200),
  66. IsDeleted = c.Boolean(nullable: false),
  67. DeleterUserId = c.Long(),
  68. DeletionTime = c.DateTime(),
  69. LastModificationTime = c.DateTime(),
  70. LastModifierUserId = c.Long(),
  71. CreationTime = c.DateTime(nullable: false),
  72. CreatorUserId = c.Long(),
  73. },
  74. annotations: new Dictionary<string, object>
  75. {
  76. { "DynamicFilter_PhoneQuestionInfo_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
  77. })
  78. .PrimaryKey(t => t.Id)
  79. .ForeignKey("dbo.Sys_Users", t => t.CreatorUserId)
  80. .ForeignKey("dbo.Sys_Users", t => t.DeleterUserId)
  81. .ForeignKey("dbo.Sys_Users", t => t.LastModifierUserId)
  82. .Index(t => t.IsDeleted)
  83. .Index(t => t.DeleterUserId)
  84. .Index(t => t.LastModifierUserId)
  85. .Index(t => t.CreatorUserId);
  86. CreateTable(
  87. "dbo.Bs_StudentHelps",
  88. c => new
  89. {
  90. Id = c.String(nullable: false, maxLength: 128),
  91. HelpName = c.String(maxLength: 50),
  92. HelpContent = c.String(maxLength: 200),
  93. IsDeleted = c.Boolean(nullable: false),
  94. DeleterUserId = c.Long(),
  95. DeletionTime = c.DateTime(),
  96. LastModificationTime = c.DateTime(),
  97. LastModifierUserId = c.Long(),
  98. CreationTime = c.DateTime(nullable: false),
  99. CreatorUserId = c.Long(),
  100. },
  101. annotations: new Dictionary<string, object>
  102. {
  103. { "DynamicFilter_StudentHelpInfo_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
  104. })
  105. .PrimaryKey(t => t.Id)
  106. .ForeignKey("dbo.Sys_Users", t => t.CreatorUserId)
  107. .ForeignKey("dbo.Sys_Users", t => t.DeleterUserId)
  108. .ForeignKey("dbo.Sys_Users", t => t.LastModifierUserId)
  109. .Index(t => t.IsDeleted)
  110. .Index(t => t.DeleterUserId)
  111. .Index(t => t.LastModifierUserId)
  112. .Index(t => t.CreatorUserId);
  113. AddColumn("dbo.Train_Camps", "MaxRoundMinute", c => c.Decimal(nullable: false, precision: 18, scale: 2));
  114. AddColumn("dbo.Train_CampSceneMaps", "PhoneQuestionNo", c => c.String());
  115. AddColumn("dbo.Train_CampGroupScores", "Scores", c => c.String());
  116. CreateIndex("dbo.Sys_Settings", "TenantId");
  117. CreateIndex("dbo.Sys_Settings", "UserId");
  118. }
  119. public override void Down()
  120. {
  121. DropForeignKey("dbo.Bs_StudentHelps", "LastModifierUserId", "dbo.Sys_Users");
  122. DropForeignKey("dbo.Bs_StudentHelps", "DeleterUserId", "dbo.Sys_Users");
  123. DropForeignKey("dbo.Bs_StudentHelps", "CreatorUserId", "dbo.Sys_Users");
  124. DropForeignKey("dbo.Bs_PhoneQuestionAnswers", "QuestionNo", "dbo.Bs_PhoneQuestions");
  125. DropForeignKey("dbo.Bs_PhoneQuestions", "LastModifierUserId", "dbo.Sys_Users");
  126. DropForeignKey("dbo.Bs_PhoneQuestions", "DeleterUserId", "dbo.Sys_Users");
  127. DropForeignKey("dbo.Bs_PhoneQuestions", "CreatorUserId", "dbo.Sys_Users");
  128. DropForeignKey("dbo.Bs_PhoneQuestionAnswers", "LastModifierUserId", "dbo.Sys_Users");
  129. DropForeignKey("dbo.Bs_PhoneQuestionAnswers", "DeleterUserId", "dbo.Sys_Users");
  130. DropForeignKey("dbo.Bs_PhoneQuestionAnswers", "CreatorUserId", "dbo.Sys_Users");
  131. DropForeignKey("dbo.Train_CampHelps", "CreatorUserId", "dbo.Sys_Users");
  132. DropForeignKey("dbo.Train_CampHelps", "CampNo", "dbo.Train_Camps");
  133. DropIndex("dbo.Bs_StudentHelps", new[] { "CreatorUserId" });
  134. DropIndex("dbo.Bs_StudentHelps", new[] { "LastModifierUserId" });
  135. DropIndex("dbo.Bs_StudentHelps", new[] { "DeleterUserId" });
  136. DropIndex("dbo.Bs_StudentHelps", new[] { "IsDeleted" });
  137. DropIndex("dbo.Bs_PhoneQuestions", new[] { "CreatorUserId" });
  138. DropIndex("dbo.Bs_PhoneQuestions", new[] { "LastModifierUserId" });
  139. DropIndex("dbo.Bs_PhoneQuestions", new[] { "DeleterUserId" });
  140. DropIndex("dbo.Bs_PhoneQuestions", new[] { "IsDeleted" });
  141. DropIndex("dbo.Bs_PhoneQuestionAnswers", new[] { "CreatorUserId" });
  142. DropIndex("dbo.Bs_PhoneQuestionAnswers", new[] { "LastModifierUserId" });
  143. DropIndex("dbo.Bs_PhoneQuestionAnswers", new[] { "DeleterUserId" });
  144. DropIndex("dbo.Bs_PhoneQuestionAnswers", new[] { "IsDeleted" });
  145. DropIndex("dbo.Bs_PhoneQuestionAnswers", new[] { "QuestionNo" });
  146. DropIndex("dbo.Train_CampHelps", new[] { "CreatorUserId" });
  147. DropIndex("dbo.Train_CampHelps", new[] { "CampNo" });
  148. DropIndex("dbo.Sys_Settings", new[] { "UserId" });
  149. DropIndex("dbo.Sys_Settings", new[] { "TenantId" });
  150. DropColumn("dbo.Train_CampGroupScores", "Scores");
  151. DropColumn("dbo.Train_CampSceneMaps", "PhoneQuestionNo");
  152. DropColumn("dbo.Train_Camps", "MaxRoundMinute");
  153. DropTable("dbo.Bs_StudentHelps",
  154. removedAnnotations: new Dictionary<string, object>
  155. {
  156. { "DynamicFilter_StudentHelpInfo_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
  157. });
  158. DropTable("dbo.Bs_PhoneQuestions",
  159. removedAnnotations: new Dictionary<string, object>
  160. {
  161. { "DynamicFilter_PhoneQuestionInfo_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
  162. });
  163. DropTable("dbo.Bs_PhoneQuestionAnswers",
  164. removedAnnotations: new Dictionary<string, object>
  165. {
  166. { "DynamicFilter_PhoneAnswerInfo_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
  167. });
  168. DropTable("dbo.Train_CampHelps");
  169. }
  170. }
  171. }