API
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20200624064952_publish-2020-06-24.cs 8.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
  4. namespace UnivateProperties_API.Migrations
  5. {
  6. public partial class publish20200624 : Migration
  7. {
  8. protected override void Up(MigrationBuilder migrationBuilder)
  9. {
  10. migrationBuilder.AddColumn<DateTime>(
  11. name: "StatusDate",
  12. table: "Properties",
  13. nullable: false,
  14. defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
  15. migrationBuilder.CreateTable(
  16. name: "Campaigns",
  17. columns: table => new
  18. {
  19. Id = table.Column<int>(nullable: false)
  20. .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
  21. Created = table.Column<DateTime>(nullable: false),
  22. Modified = table.Column<DateTime>(nullable: false),
  23. ModifiedBy = table.Column<string>(nullable: true),
  24. IsDeleted = table.Column<bool>(nullable: false),
  25. StartDate = table.Column<DateTime>(nullable: false),
  26. EndDate = table.Column<DateTime>(nullable: false),
  27. Name = table.Column<string>(nullable: true),
  28. Subject = table.Column<string>(nullable: true),
  29. Body = table.Column<string>(nullable: true),
  30. ItemBody = table.Column<string>(nullable: true),
  31. ItemsPerRow = table.Column<int>(nullable: false)
  32. },
  33. constraints: table =>
  34. {
  35. table.PrimaryKey("PK_Campaigns", x => x.Id);
  36. });
  37. migrationBuilder.CreateTable(
  38. name: "Defaults",
  39. columns: table => new
  40. {
  41. Id = table.Column<string>(nullable: false),
  42. Value = table.Column<string>(nullable: true)
  43. },
  44. constraints: table =>
  45. {
  46. table.PrimaryKey("PK_Defaults", x => x.Id);
  47. });
  48. migrationBuilder.CreateTable(
  49. name: "PlaceHolderFormats",
  50. columns: table => new
  51. {
  52. Id = table.Column<int>(nullable: false)
  53. .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
  54. Created = table.Column<DateTime>(nullable: false),
  55. Modified = table.Column<DateTime>(nullable: false),
  56. ModifiedBy = table.Column<string>(nullable: true),
  57. IsDeleted = table.Column<bool>(nullable: false),
  58. DisplayName = table.Column<string>(nullable: true),
  59. Format = table.Column<string>(nullable: true)
  60. },
  61. constraints: table =>
  62. {
  63. table.PrimaryKey("PK_PlaceHolderFormats", x => x.Id);
  64. });
  65. migrationBuilder.CreateTable(
  66. name: "CampaignItems",
  67. columns: table => new
  68. {
  69. Id = table.Column<int>(nullable: false)
  70. .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
  71. Created = table.Column<DateTime>(nullable: false),
  72. Modified = table.Column<DateTime>(nullable: false),
  73. ModifiedBy = table.Column<string>(nullable: true),
  74. IsDeleted = table.Column<bool>(nullable: false),
  75. CampaignId = table.Column<int>(nullable: false),
  76. WeekId = table.Column<int>(nullable: false),
  77. Image = table.Column<string>(nullable: true)
  78. },
  79. constraints: table =>
  80. {
  81. table.PrimaryKey("PK_CampaignItems", x => x.Id);
  82. table.ForeignKey(
  83. name: "FK_CampaignItems_Campaigns_CampaignId",
  84. column: x => x.CampaignId,
  85. principalTable: "Campaigns",
  86. principalColumn: "Id",
  87. onDelete: ReferentialAction.Cascade);
  88. table.ForeignKey(
  89. name: "FK_CampaignItems_Weeks_WeekId",
  90. column: x => x.WeekId,
  91. principalTable: "Weeks",
  92. principalColumn: "Id",
  93. onDelete: ReferentialAction.Cascade);
  94. });
  95. migrationBuilder.CreateTable(
  96. name: "CampaignPlaceHolders",
  97. columns: table => new
  98. {
  99. Id = table.Column<int>(nullable: false)
  100. .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
  101. Created = table.Column<DateTime>(nullable: false),
  102. Modified = table.Column<DateTime>(nullable: false),
  103. ModifiedBy = table.Column<string>(nullable: true),
  104. IsDeleted = table.Column<bool>(nullable: false),
  105. Name = table.Column<string>(nullable: true),
  106. BoundToClass = table.Column<string>(nullable: true),
  107. BoundToClassDisplay = table.Column<string>(nullable: true),
  108. BoundTo = table.Column<string>(nullable: true),
  109. Format = table.Column<string>(nullable: true),
  110. CampaignId = table.Column<int>(nullable: false)
  111. },
  112. constraints: table =>
  113. {
  114. table.PrimaryKey("PK_CampaignPlaceHolders", x => x.Id);
  115. table.ForeignKey(
  116. name: "FK_CampaignPlaceHolders_Campaigns_CampaignId",
  117. column: x => x.CampaignId,
  118. principalTable: "Campaigns",
  119. principalColumn: "Id",
  120. onDelete: ReferentialAction.Cascade);
  121. });
  122. migrationBuilder.CreateTable(
  123. name: "CampaignItemPlaceHolders",
  124. columns: table => new
  125. {
  126. Id = table.Column<int>(nullable: false)
  127. .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
  128. Created = table.Column<DateTime>(nullable: false),
  129. Modified = table.Column<DateTime>(nullable: false),
  130. ModifiedBy = table.Column<string>(nullable: true),
  131. IsDeleted = table.Column<bool>(nullable: false),
  132. CampaignItemId = table.Column<int>(nullable: false),
  133. PlaceHolder = table.Column<string>(nullable: true),
  134. Value = table.Column<string>(nullable: true)
  135. },
  136. constraints: table =>
  137. {
  138. table.PrimaryKey("PK_CampaignItemPlaceHolders", x => x.Id);
  139. table.ForeignKey(
  140. name: "FK_CampaignItemPlaceHolders_CampaignItems_CampaignItemId",
  141. column: x => x.CampaignItemId,
  142. principalTable: "CampaignItems",
  143. principalColumn: "Id",
  144. onDelete: ReferentialAction.Cascade);
  145. });
  146. migrationBuilder.CreateIndex(
  147. name: "IX_CampaignItemPlaceHolders_CampaignItemId",
  148. table: "CampaignItemPlaceHolders",
  149. column: "CampaignItemId");
  150. migrationBuilder.CreateIndex(
  151. name: "IX_CampaignItems_CampaignId",
  152. table: "CampaignItems",
  153. column: "CampaignId");
  154. migrationBuilder.CreateIndex(
  155. name: "IX_CampaignItems_WeekId",
  156. table: "CampaignItems",
  157. column: "WeekId");
  158. migrationBuilder.CreateIndex(
  159. name: "IX_CampaignPlaceHolders_CampaignId",
  160. table: "CampaignPlaceHolders",
  161. column: "CampaignId");
  162. }
  163. protected override void Down(MigrationBuilder migrationBuilder)
  164. {
  165. migrationBuilder.DropTable(
  166. name: "CampaignItemPlaceHolders");
  167. migrationBuilder.DropTable(
  168. name: "CampaignPlaceHolders");
  169. migrationBuilder.DropTable(
  170. name: "Defaults");
  171. migrationBuilder.DropTable(
  172. name: "PlaceHolderFormats");
  173. migrationBuilder.DropTable(
  174. name: "CampaignItems");
  175. migrationBuilder.DropTable(
  176. name: "Campaigns");
  177. migrationBuilder.DropColumn(
  178. name: "StatusDate",
  179. table: "Properties");
  180. }
  181. }
  182. }