summaryrefslogtreecommitdiff
path: root/backend/Elements.Data/Migrations/20231021150037_Add initial data.cs
blob: a7d24f3d9a1724ac8311f2cf747c8d4b9be1ae14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional

namespace Elements.Data.Migrations
{
    /// <inheritdoc />
    public partial class Addinitialdata : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Suggestion_Elements_FirstIngredientId",
                table: "Suggestion");

            migrationBuilder.DropForeignKey(
                name: "FK_Suggestion_Elements_SecondIngredientId",
                table: "Suggestion");

            migrationBuilder.DropForeignKey(
                name: "FK_Suggestion_Users_UserId",
                table: "Suggestion");

            migrationBuilder.DropPrimaryKey(
                name: "PK_Suggestion",
                table: "Suggestion");

            migrationBuilder.RenameTable(
                name: "Suggestion",
                newName: "Suggestions");

            migrationBuilder.RenameIndex(
                name: "IX_Suggestion_UserId",
                table: "Suggestions",
                newName: "IX_Suggestions_UserId");

            migrationBuilder.RenameIndex(
                name: "IX_Suggestion_SecondIngredientId",
                table: "Suggestions",
                newName: "IX_Suggestions_SecondIngredientId");

            migrationBuilder.RenameIndex(
                name: "IX_Suggestion_FirstIngredientId",
                table: "Suggestions",
                newName: "IX_Suggestions_FirstIngredientId");

            migrationBuilder.AddPrimaryKey(
                name: "PK_Suggestions",
                table: "Suggestions",
                column: "Id");

            migrationBuilder.CreateTable(
                name: "Recipes",
                columns: table => new
                {
                    Id = table.Column<int>(type: "INTEGER", nullable: false)
                        .Annotation("Sqlite:Autoincrement", true),
                    FirstIngredientId = table.Column<int>(type: "INTEGER", nullable: false),
                    SecondIngredientId = table.Column<int>(type: "INTEGER", nullable: false),
                    ResultId = table.Column<int>(type: "INTEGER", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Recipes", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Recipes_Elements_FirstIngredientId",
                        column: x => x.FirstIngredientId,
                        principalTable: "Elements",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_Recipes_Elements_ResultId",
                        column: x => x.ResultId,
                        principalTable: "Elements",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_Recipes_Elements_SecondIngredientId",
                        column: x => x.SecondIngredientId,
                        principalTable: "Elements",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.InsertData(
                table: "Users",
                columns: new[] { "Id", "GoogleId", "Name" },
                values: new object[] { 1, "", "Elements" });

            migrationBuilder.InsertData(
                table: "Elements",
                columns: new[] { "Id", "IconBitmap", "Name", "State", "UserId" },
                values: new object[,]
                {
                    { 1, "/wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA/w==", "Fire", 1, 1 },
                    { 2, "IZb9/yGW/f8hlv3/IZ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b9/yGW/f8hlv3/IZb9/yGW/f8hlv3/IZb9/yGW/f8hlv3/IZb9/yGW/f8hlv3/IZb9/yGW/f8hlv3/IZb9/yGW/f8hlv3/IZb9/yGW/f8hlv3/IZb9/yGW/f8hlv3/IZb9/yGW/f8hlv3/IZb9/yGW/f8hlv3/IZb9/yGW/f8hlv3/IZb9/yGW/f8hlv3/IZb9/yGW/f8hlv3/IZb9/yGW/f8hlv3/IZb9/yGW/f8hlv3/IZb9/yGW/f8hlv3/IZb9/yGW/f8hlv3/IZb9/yGW/f8hlv3/IZb9/yGW/f8hlv3/IZb9/yGW/f8hlv3/IZb9/w==", "Water", 1, 1 },
                    { 3, "u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/7ve+/+73vv/u977/w==", "Air", 1, 1 },
                    { 4, "XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/11AN/9dQDf/XUA3/w==", "Ground", 1, 1 }
                });

            migrationBuilder.CreateIndex(
                name: "IX_Recipes_FirstIngredientId",
                table: "Recipes",
                column: "FirstIngredientId");

            migrationBuilder.CreateIndex(
                name: "IX_Recipes_ResultId",
                table: "Recipes",
                column: "ResultId");

            migrationBuilder.CreateIndex(
                name: "IX_Recipes_SecondIngredientId",
                table: "Recipes",
                column: "SecondIngredientId");

            migrationBuilder.AddForeignKey(
                name: "FK_Suggestions_Elements_FirstIngredientId",
                table: "Suggestions",
                column: "FirstIngredientId",
                principalTable: "Elements",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_Suggestions_Elements_SecondIngredientId",
                table: "Suggestions",
                column: "SecondIngredientId",
                principalTable: "Elements",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_Suggestions_Users_UserId",
                table: "Suggestions",
                column: "UserId",
                principalTable: "Users",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Suggestions_Elements_FirstIngredientId",
                table: "Suggestions");

            migrationBuilder.DropForeignKey(
                name: "FK_Suggestions_Elements_SecondIngredientId",
                table: "Suggestions");

            migrationBuilder.DropForeignKey(
                name: "FK_Suggestions_Users_UserId",
                table: "Suggestions");

            migrationBuilder.DropTable(
                name: "Recipes");

            migrationBuilder.DropPrimaryKey(
                name: "PK_Suggestions",
                table: "Suggestions");

            migrationBuilder.DeleteData(
                table: "Elements",
                keyColumn: "Id",
                keyValue: 1);

            migrationBuilder.DeleteData(
                table: "Elements",
                keyColumn: "Id",
                keyValue: 2);

            migrationBuilder.DeleteData(
                table: "Elements",
                keyColumn: "Id",
                keyValue: 3);

            migrationBuilder.DeleteData(
                table: "Elements",
                keyColumn: "Id",
                keyValue: 4);

            migrationBuilder.DeleteData(
                table: "Users",
                keyColumn: "Id",
                keyValue: 1);

            migrationBuilder.RenameTable(
                name: "Suggestions",
                newName: "Suggestion");

            migrationBuilder.RenameIndex(
                name: "IX_Suggestions_UserId",
                table: "Suggestion",
                newName: "IX_Suggestion_UserId");

            migrationBuilder.RenameIndex(
                name: "IX_Suggestions_SecondIngredientId",
                table: "Suggestion",
                newName: "IX_Suggestion_SecondIngredientId");

            migrationBuilder.RenameIndex(
                name: "IX_Suggestions_FirstIngredientId",
                table: "Suggestion",
                newName: "IX_Suggestion_FirstIngredientId");

            migrationBuilder.AddPrimaryKey(
                name: "PK_Suggestion",
                table: "Suggestion",
                column: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_Suggestion_Elements_FirstIngredientId",
                table: "Suggestion",
                column: "FirstIngredientId",
                principalTable: "Elements",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_Suggestion_Elements_SecondIngredientId",
                table: "Suggestion",
                column: "SecondIngredientId",
                principalTable: "Elements",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_Suggestion_Users_UserId",
                table: "Suggestion",
                column: "UserId",
                principalTable: "Users",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
    }
}