123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200 |
- using System;
- using Microsoft.EntityFrameworkCore.Migrations;
- using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
-
- namespace UnivateProperties_API.Migrations
- {
- public partial class publish20200624 : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AddColumn<DateTime>(
- name: "StatusDate",
- table: "Properties",
- nullable: false,
- defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
-
- migrationBuilder.CreateTable(
- name: "Campaigns",
- columns: table => new
- {
- Id = table.Column<int>(nullable: false)
- .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
- Created = table.Column<DateTime>(nullable: false),
- Modified = table.Column<DateTime>(nullable: false),
- ModifiedBy = table.Column<string>(nullable: true),
- IsDeleted = table.Column<bool>(nullable: false),
- StartDate = table.Column<DateTime>(nullable: false),
- EndDate = table.Column<DateTime>(nullable: false),
- Name = table.Column<string>(nullable: true),
- Subject = table.Column<string>(nullable: true),
- Body = table.Column<string>(nullable: true),
- ItemBody = table.Column<string>(nullable: true),
- ItemsPerRow = table.Column<int>(nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Campaigns", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "Defaults",
- columns: table => new
- {
- Id = table.Column<string>(nullable: false),
- Value = table.Column<string>(nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Defaults", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "PlaceHolderFormats",
- columns: table => new
- {
- Id = table.Column<int>(nullable: false)
- .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
- Created = table.Column<DateTime>(nullable: false),
- Modified = table.Column<DateTime>(nullable: false),
- ModifiedBy = table.Column<string>(nullable: true),
- IsDeleted = table.Column<bool>(nullable: false),
- DisplayName = table.Column<string>(nullable: true),
- Format = table.Column<string>(nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_PlaceHolderFormats", x => x.Id);
- });
-
- migrationBuilder.CreateTable(
- name: "CampaignItems",
- columns: table => new
- {
- Id = table.Column<int>(nullable: false)
- .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
- Created = table.Column<DateTime>(nullable: false),
- Modified = table.Column<DateTime>(nullable: false),
- ModifiedBy = table.Column<string>(nullable: true),
- IsDeleted = table.Column<bool>(nullable: false),
- CampaignId = table.Column<int>(nullable: false),
- WeekId = table.Column<int>(nullable: false),
- Image = table.Column<string>(nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_CampaignItems", x => x.Id);
- table.ForeignKey(
- name: "FK_CampaignItems_Campaigns_CampaignId",
- column: x => x.CampaignId,
- principalTable: "Campaigns",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_CampaignItems_Weeks_WeekId",
- column: x => x.WeekId,
- principalTable: "Weeks",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "CampaignPlaceHolders",
- columns: table => new
- {
- Id = table.Column<int>(nullable: false)
- .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
- Created = table.Column<DateTime>(nullable: false),
- Modified = table.Column<DateTime>(nullable: false),
- ModifiedBy = table.Column<string>(nullable: true),
- IsDeleted = table.Column<bool>(nullable: false),
- Name = table.Column<string>(nullable: true),
- BoundToClass = table.Column<string>(nullable: true),
- BoundToClassDisplay = table.Column<string>(nullable: true),
- BoundTo = table.Column<string>(nullable: true),
- Format = table.Column<string>(nullable: true),
- CampaignId = table.Column<int>(nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_CampaignPlaceHolders", x => x.Id);
- table.ForeignKey(
- name: "FK_CampaignPlaceHolders_Campaigns_CampaignId",
- column: x => x.CampaignId,
- principalTable: "Campaigns",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "CampaignItemPlaceHolders",
- columns: table => new
- {
- Id = table.Column<int>(nullable: false)
- .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
- Created = table.Column<DateTime>(nullable: false),
- Modified = table.Column<DateTime>(nullable: false),
- ModifiedBy = table.Column<string>(nullable: true),
- IsDeleted = table.Column<bool>(nullable: false),
- CampaignItemId = table.Column<int>(nullable: false),
- PlaceHolder = table.Column<string>(nullable: true),
- Value = table.Column<string>(nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_CampaignItemPlaceHolders", x => x.Id);
- table.ForeignKey(
- name: "FK_CampaignItemPlaceHolders_CampaignItems_CampaignItemId",
- column: x => x.CampaignItemId,
- principalTable: "CampaignItems",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateIndex(
- name: "IX_CampaignItemPlaceHolders_CampaignItemId",
- table: "CampaignItemPlaceHolders",
- column: "CampaignItemId");
-
- migrationBuilder.CreateIndex(
- name: "IX_CampaignItems_CampaignId",
- table: "CampaignItems",
- column: "CampaignId");
-
- migrationBuilder.CreateIndex(
- name: "IX_CampaignItems_WeekId",
- table: "CampaignItems",
- column: "WeekId");
-
- migrationBuilder.CreateIndex(
- name: "IX_CampaignPlaceHolders_CampaignId",
- table: "CampaignPlaceHolders",
- column: "CampaignId");
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "CampaignItemPlaceHolders");
-
- migrationBuilder.DropTable(
- name: "CampaignPlaceHolders");
-
- migrationBuilder.DropTable(
- name: "Defaults");
-
- migrationBuilder.DropTable(
- name: "PlaceHolderFormats");
-
- migrationBuilder.DropTable(
- name: "CampaignItems");
-
- migrationBuilder.DropTable(
- name: "Campaigns");
-
- migrationBuilder.DropColumn(
- name: "StatusDate",
- table: "Properties");
- }
- }
- }
|