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