Revize 5f000cb0
Přidáno uživatelem Vojtěch Bartička před více než 2 roky(ů)
Backend/Backend/Migrations/20220330142537_v1.Designer.cs | ||
---|---|---|
1 |
// <auto-generated /> |
|
2 |
using System; |
|
3 |
using Core.Contexts; |
|
4 |
using Microsoft.EntityFrameworkCore; |
|
5 |
using Microsoft.EntityFrameworkCore.Infrastructure; |
|
6 |
using Microsoft.EntityFrameworkCore.Migrations; |
|
7 |
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; |
|
8 |
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; |
|
9 |
|
|
10 |
#nullable disable |
|
11 |
|
|
12 |
namespace RestAPI.Migrations |
|
13 |
{ |
|
14 |
[DbContext(typeof(DatabaseContext))] |
|
15 |
[Migration("20220330142537_v1")] |
|
16 |
partial class v1 |
|
17 |
{ |
|
18 |
protected override void BuildTargetModel(ModelBuilder modelBuilder) |
|
19 |
{ |
|
20 |
#pragma warning disable 612, 618 |
|
21 |
modelBuilder |
|
22 |
.HasAnnotation("ProductVersion", "6.0.3") |
|
23 |
.HasAnnotation("Relational:MaxIdentifierLength", 63); |
|
24 |
|
|
25 |
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); |
|
26 |
|
|
27 |
modelBuilder.Entity("AnnotationClass", b => |
|
28 |
{ |
|
29 |
b.Property<Guid>("AnnotationsId") |
|
30 |
.HasColumnType("uuid"); |
|
31 |
|
|
32 |
b.Property<Guid>("ClassesId") |
|
33 |
.HasColumnType("uuid"); |
|
34 |
|
|
35 |
b.HasKey("AnnotationsId", "ClassesId"); |
|
36 |
|
|
37 |
b.HasIndex("ClassesId"); |
|
38 |
|
|
39 |
b.ToTable("AnnotationClass"); |
|
40 |
}); |
|
41 |
|
|
42 |
modelBuilder.Entity("Core.Entities.Annotation", b => |
|
43 |
{ |
|
44 |
b.Property<Guid>("Id") |
|
45 |
.ValueGeneratedOnAdd() |
|
46 |
.HasColumnType("uuid"); |
|
47 |
|
|
48 |
b.Property<DateTime>("DateAssigned") |
|
49 |
.HasColumnType("timestamp with time zone"); |
|
50 |
|
|
51 |
b.Property<DateTime>("DateLastChanged") |
|
52 |
.HasColumnType("timestamp with time zone"); |
|
53 |
|
|
54 |
b.Property<Guid>("DocumentId") |
|
55 |
.HasColumnType("uuid"); |
|
56 |
|
|
57 |
b.Property<string>("Note") |
|
58 |
.IsRequired() |
|
59 |
.HasColumnType("text"); |
|
60 |
|
|
61 |
b.Property<int>("State") |
|
62 |
.HasColumnType("integer"); |
|
63 |
|
|
64 |
b.Property<Guid>("UserAssignedId") |
|
65 |
.HasColumnType("uuid"); |
|
66 |
|
|
67 |
b.Property<Guid>("UserId") |
|
68 |
.HasColumnType("uuid"); |
|
69 |
|
|
70 |
b.HasKey("Id"); |
|
71 |
|
|
72 |
b.HasIndex("DocumentId"); |
|
73 |
|
|
74 |
b.HasIndex("UserAssignedId"); |
|
75 |
|
|
76 |
b.HasIndex("UserId"); |
|
77 |
|
|
78 |
b.ToTable("Annotations"); |
|
79 |
}); |
|
80 |
|
|
81 |
modelBuilder.Entity("Core.Entities.AnnotationTag", b => |
|
82 |
{ |
|
83 |
b.Property<Guid>("Id") |
|
84 |
.ValueGeneratedOnAdd() |
|
85 |
.HasColumnType("uuid"); |
|
86 |
|
|
87 |
b.Property<Guid>("AnnotationId") |
|
88 |
.HasColumnType("uuid"); |
|
89 |
|
|
90 |
b.Property<int>("Instance") |
|
91 |
.HasColumnType("integer"); |
|
92 |
|
|
93 |
b.Property<int>("Length") |
|
94 |
.HasColumnType("integer"); |
|
95 |
|
|
96 |
b.Property<string>("Note") |
|
97 |
.IsRequired() |
|
98 |
.HasColumnType("text"); |
|
99 |
|
|
100 |
b.Property<int>("Position") |
|
101 |
.HasColumnType("integer"); |
|
102 |
|
|
103 |
b.Property<Guid?>("SubTagId") |
|
104 |
.HasColumnType("uuid"); |
|
105 |
|
|
106 |
b.Property<Guid>("TagId") |
|
107 |
.HasColumnType("uuid"); |
|
108 |
|
|
109 |
b.HasKey("Id"); |
|
110 |
|
|
111 |
b.HasIndex("AnnotationId"); |
|
112 |
|
|
113 |
b.HasIndex("SubTagId"); |
|
114 |
|
|
115 |
b.HasIndex("TagId"); |
|
116 |
|
|
117 |
b.ToTable("AnnotationTags"); |
|
118 |
}); |
|
119 |
|
|
120 |
modelBuilder.Entity("Core.Entities.Class", b => |
|
121 |
{ |
|
122 |
b.Property<Guid>("Id") |
|
123 |
.ValueGeneratedOnAdd() |
|
124 |
.HasColumnType("uuid"); |
|
125 |
|
|
126 |
b.Property<string>("Color") |
|
127 |
.IsRequired() |
|
128 |
.HasColumnType("text"); |
|
129 |
|
|
130 |
b.Property<string>("Description") |
|
131 |
.IsRequired() |
|
132 |
.HasColumnType("text"); |
|
133 |
|
|
134 |
b.Property<string>("Name") |
|
135 |
.IsRequired() |
|
136 |
.HasColumnType("text"); |
|
137 |
|
|
138 |
b.HasKey("Id"); |
|
139 |
|
|
140 |
b.ToTable("Classes"); |
|
141 |
}); |
|
142 |
|
|
143 |
modelBuilder.Entity("Core.Entities.Document", b => |
|
144 |
{ |
|
145 |
b.Property<Guid>("Id") |
|
146 |
.ValueGeneratedOnAdd() |
|
147 |
.HasColumnType("uuid"); |
|
148 |
|
|
149 |
b.Property<Guid>("ContentId") |
|
150 |
.HasColumnType("uuid"); |
|
151 |
|
|
152 |
b.Property<DateTime>("DateAdded") |
|
153 |
.HasColumnType("timestamp with time zone"); |
|
154 |
|
|
155 |
b.Property<int>("Length") |
|
156 |
.HasColumnType("integer"); |
|
157 |
|
|
158 |
b.Property<string>("Name") |
|
159 |
.IsRequired() |
|
160 |
.HasColumnType("text"); |
|
161 |
|
|
162 |
b.Property<int>("RequiredAnnotations") |
|
163 |
.HasColumnType("integer"); |
|
164 |
|
|
165 |
b.Property<Guid>("UserAddedId") |
|
166 |
.HasColumnType("uuid"); |
|
167 |
|
|
168 |
b.HasKey("Id"); |
|
169 |
|
|
170 |
b.HasIndex("ContentId"); |
|
171 |
|
|
172 |
b.HasIndex("UserAddedId"); |
|
173 |
|
|
174 |
b.ToTable("Documents"); |
|
175 |
}); |
|
176 |
|
|
177 |
modelBuilder.Entity("Core.Entities.DocumentContent", b => |
|
178 |
{ |
|
179 |
b.Property<Guid>("Id") |
|
180 |
.ValueGeneratedOnAdd() |
|
181 |
.HasColumnType("uuid"); |
|
182 |
|
|
183 |
b.Property<string>("Content") |
|
184 |
.IsRequired() |
|
185 |
.HasColumnType("text"); |
|
186 |
|
|
187 |
b.HasKey("Id"); |
|
188 |
|
|
189 |
b.ToTable("DocumentContents"); |
|
190 |
}); |
|
191 |
|
|
192 |
modelBuilder.Entity("Core.Entities.SubTag", b => |
|
193 |
{ |
|
194 |
b.Property<Guid>("Id") |
|
195 |
.ValueGeneratedOnAdd() |
|
196 |
.HasColumnType("uuid"); |
|
197 |
|
|
198 |
b.Property<string>("Description") |
|
199 |
.IsRequired() |
|
200 |
.HasColumnType("text"); |
|
201 |
|
|
202 |
b.Property<string>("Name") |
|
203 |
.IsRequired() |
|
204 |
.HasColumnType("text"); |
|
205 |
|
|
206 |
b.Property<Guid>("TagId") |
|
207 |
.HasColumnType("uuid"); |
|
208 |
|
|
209 |
b.HasKey("Id"); |
|
210 |
|
|
211 |
b.HasIndex("TagId"); |
|
212 |
|
|
213 |
b.ToTable("SubTags"); |
|
214 |
}); |
|
215 |
|
|
216 |
modelBuilder.Entity("Core.Entities.Tag", b => |
|
217 |
{ |
|
218 |
b.Property<Guid>("Id") |
|
219 |
.ValueGeneratedOnAdd() |
|
220 |
.HasColumnType("uuid"); |
|
221 |
|
|
222 |
b.Property<Guid>("CategoryId") |
|
223 |
.HasColumnType("uuid"); |
|
224 |
|
|
225 |
b.Property<string>("Color") |
|
226 |
.IsRequired() |
|
227 |
.HasColumnType("text"); |
|
228 |
|
|
229 |
b.Property<string>("Description") |
|
230 |
.IsRequired() |
|
231 |
.HasColumnType("text"); |
|
232 |
|
|
233 |
b.Property<string>("Name") |
|
234 |
.IsRequired() |
|
235 |
.HasColumnType("text"); |
|
236 |
|
|
237 |
b.HasKey("Id"); |
|
238 |
|
|
239 |
b.HasIndex("CategoryId"); |
|
240 |
|
|
241 |
b.ToTable("Tags"); |
|
242 |
}); |
|
243 |
|
|
244 |
modelBuilder.Entity("Core.Entities.TagCategory", b => |
|
245 |
{ |
|
246 |
b.Property<Guid>("Id") |
|
247 |
.ValueGeneratedOnAdd() |
|
248 |
.HasColumnType("uuid"); |
|
249 |
|
|
250 |
b.Property<string>("Color") |
|
251 |
.IsRequired() |
|
252 |
.HasColumnType("text"); |
|
253 |
|
|
254 |
b.Property<string>("Description") |
|
255 |
.IsRequired() |
|
256 |
.HasColumnType("text"); |
|
257 |
|
|
258 |
b.Property<string>("Name") |
|
259 |
.IsRequired() |
|
260 |
.HasColumnType("text"); |
|
261 |
|
|
262 |
b.HasKey("Id"); |
|
263 |
|
|
264 |
b.ToTable("TagCategories"); |
|
265 |
}); |
|
266 |
|
|
267 |
modelBuilder.Entity("Core.Entities.User", b => |
|
268 |
{ |
|
269 |
b.Property<Guid>("Id") |
|
270 |
.ValueGeneratedOnAdd() |
|
271 |
.HasColumnType("uuid"); |
|
272 |
|
|
273 |
b.Property<string>("Name") |
|
274 |
.IsRequired() |
|
275 |
.HasColumnType("text"); |
|
276 |
|
|
277 |
b.Property<string>("Password") |
|
278 |
.IsRequired() |
|
279 |
.HasColumnType("text"); |
|
280 |
|
|
281 |
b.Property<int>("Role") |
|
282 |
.HasColumnType("integer"); |
|
283 |
|
|
284 |
b.Property<string>("Surname") |
|
285 |
.IsRequired() |
|
286 |
.HasColumnType("text"); |
|
287 |
|
|
288 |
b.Property<string>("Username") |
|
289 |
.IsRequired() |
|
290 |
.HasColumnType("text"); |
|
291 |
|
|
292 |
b.HasKey("Id"); |
|
293 |
|
|
294 |
b.ToTable("Users"); |
|
295 |
}); |
|
296 |
|
|
297 |
modelBuilder.Entity("AnnotationClass", b => |
|
298 |
{ |
|
299 |
b.HasOne("Core.Entities.Annotation", null) |
|
300 |
.WithMany() |
|
301 |
.HasForeignKey("AnnotationsId") |
|
302 |
.OnDelete(DeleteBehavior.Cascade) |
|
303 |
.IsRequired(); |
|
304 |
|
|
305 |
b.HasOne("Core.Entities.Class", null) |
|
306 |
.WithMany() |
|
307 |
.HasForeignKey("ClassesId") |
|
308 |
.OnDelete(DeleteBehavior.Cascade) |
|
309 |
.IsRequired(); |
|
310 |
}); |
|
311 |
|
|
312 |
modelBuilder.Entity("Core.Entities.Annotation", b => |
|
313 |
{ |
|
314 |
b.HasOne("Core.Entities.Document", "Document") |
|
315 |
.WithMany() |
|
316 |
.HasForeignKey("DocumentId") |
|
317 |
.OnDelete(DeleteBehavior.Cascade) |
|
318 |
.IsRequired(); |
|
319 |
|
|
320 |
b.HasOne("Core.Entities.User", "UserAssigned") |
|
321 |
.WithMany() |
|
322 |
.HasForeignKey("UserAssignedId") |
|
323 |
.OnDelete(DeleteBehavior.Cascade) |
|
324 |
.IsRequired(); |
|
325 |
|
|
326 |
b.HasOne("Core.Entities.User", "User") |
|
327 |
.WithMany() |
|
328 |
.HasForeignKey("UserId") |
|
329 |
.OnDelete(DeleteBehavior.Cascade) |
|
330 |
.IsRequired(); |
|
331 |
|
|
332 |
b.Navigation("Document"); |
|
333 |
|
|
334 |
b.Navigation("User"); |
|
335 |
|
|
336 |
b.Navigation("UserAssigned"); |
|
337 |
}); |
|
338 |
|
|
339 |
modelBuilder.Entity("Core.Entities.AnnotationTag", b => |
|
340 |
{ |
|
341 |
b.HasOne("Core.Entities.Annotation", "Annotation") |
|
342 |
.WithMany() |
|
343 |
.HasForeignKey("AnnotationId") |
|
344 |
.OnDelete(DeleteBehavior.Cascade) |
|
345 |
.IsRequired(); |
|
346 |
|
|
347 |
b.HasOne("Core.Entities.SubTag", "SubTag") |
|
348 |
.WithMany() |
|
349 |
.HasForeignKey("SubTagId"); |
|
350 |
|
|
351 |
b.HasOne("Core.Entities.Tag", "Tag") |
|
352 |
.WithMany() |
|
353 |
.HasForeignKey("TagId") |
|
354 |
.OnDelete(DeleteBehavior.Cascade) |
|
355 |
.IsRequired(); |
|
356 |
|
|
357 |
b.Navigation("Annotation"); |
|
358 |
|
|
359 |
b.Navigation("SubTag"); |
|
360 |
|
|
361 |
b.Navigation("Tag"); |
|
362 |
}); |
|
363 |
|
|
364 |
modelBuilder.Entity("Core.Entities.Document", b => |
|
365 |
{ |
|
366 |
b.HasOne("Core.Entities.DocumentContent", "Content") |
|
367 |
.WithMany() |
|
368 |
.HasForeignKey("ContentId") |
|
369 |
.OnDelete(DeleteBehavior.Cascade) |
|
370 |
.IsRequired(); |
|
371 |
|
|
372 |
b.HasOne("Core.Entities.User", "UserAdded") |
|
373 |
.WithMany() |
|
374 |
.HasForeignKey("UserAddedId") |
|
375 |
.OnDelete(DeleteBehavior.Cascade) |
|
376 |
.IsRequired(); |
|
377 |
|
|
378 |
b.Navigation("Content"); |
|
379 |
|
|
380 |
b.Navigation("UserAdded"); |
|
381 |
}); |
|
382 |
|
|
383 |
modelBuilder.Entity("Core.Entities.SubTag", b => |
|
384 |
{ |
|
385 |
b.HasOne("Core.Entities.Tag", "Tag") |
|
386 |
.WithMany() |
|
387 |
.HasForeignKey("TagId") |
|
388 |
.OnDelete(DeleteBehavior.Cascade) |
|
389 |
.IsRequired(); |
|
390 |
|
|
391 |
b.Navigation("Tag"); |
|
392 |
}); |
|
393 |
|
|
394 |
modelBuilder.Entity("Core.Entities.Tag", b => |
|
395 |
{ |
|
396 |
b.HasOne("Core.Entities.TagCategory", "Category") |
|
397 |
.WithMany() |
|
398 |
.HasForeignKey("CategoryId") |
|
399 |
.OnDelete(DeleteBehavior.Cascade) |
|
400 |
.IsRequired(); |
|
401 |
|
|
402 |
b.Navigation("Category"); |
|
403 |
}); |
|
404 |
#pragma warning restore 612, 618 |
|
405 |
} |
|
406 |
} |
|
407 |
} |
Backend/Backend/Migrations/20220330142537_v1.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using Microsoft.EntityFrameworkCore.Migrations; |
|
3 |
|
|
4 |
#nullable disable |
|
5 |
|
|
6 |
namespace RestAPI.Migrations |
|
7 |
{ |
|
8 |
public partial class v1 : Migration |
|
9 |
{ |
|
10 |
protected override void Up(MigrationBuilder migrationBuilder) |
|
11 |
{ |
|
12 |
migrationBuilder.CreateTable( |
|
13 |
name: "Classes", |
|
14 |
columns: table => new |
|
15 |
{ |
|
16 |
Id = table.Column<Guid>(type: "uuid", nullable: false), |
|
17 |
Name = table.Column<string>(type: "text", nullable: false), |
|
18 |
Description = table.Column<string>(type: "text", nullable: false), |
|
19 |
Color = table.Column<string>(type: "text", nullable: false) |
|
20 |
}, |
|
21 |
constraints: table => |
|
22 |
{ |
|
23 |
table.PrimaryKey("PK_Classes", x => x.Id); |
|
24 |
}); |
|
25 |
|
|
26 |
migrationBuilder.CreateTable( |
|
27 |
name: "DocumentContents", |
|
28 |
columns: table => new |
|
29 |
{ |
|
30 |
Id = table.Column<Guid>(type: "uuid", nullable: false), |
|
31 |
Content = table.Column<string>(type: "text", nullable: false) |
|
32 |
}, |
|
33 |
constraints: table => |
|
34 |
{ |
|
35 |
table.PrimaryKey("PK_DocumentContents", x => x.Id); |
|
36 |
}); |
|
37 |
|
|
38 |
migrationBuilder.CreateTable( |
|
39 |
name: "TagCategories", |
|
40 |
columns: table => new |
|
41 |
{ |
|
42 |
Id = table.Column<Guid>(type: "uuid", nullable: false), |
|
43 |
Name = table.Column<string>(type: "text", nullable: false), |
|
44 |
Color = table.Column<string>(type: "text", nullable: false), |
|
45 |
Description = table.Column<string>(type: "text", nullable: false) |
|
46 |
}, |
|
47 |
constraints: table => |
|
48 |
{ |
|
49 |
table.PrimaryKey("PK_TagCategories", x => x.Id); |
|
50 |
}); |
|
51 |
|
|
52 |
migrationBuilder.CreateTable( |
|
53 |
name: "Users", |
|
54 |
columns: table => new |
|
55 |
{ |
|
56 |
Id = table.Column<Guid>(type: "uuid", nullable: false), |
|
57 |
Username = table.Column<string>(type: "text", nullable: false), |
|
58 |
Password = table.Column<string>(type: "text", nullable: false), |
|
59 |
Name = table.Column<string>(type: "text", nullable: false), |
|
60 |
Surname = table.Column<string>(type: "text", nullable: false), |
|
61 |
Role = table.Column<int>(type: "integer", nullable: false) |
|
62 |
}, |
|
63 |
constraints: table => |
|
64 |
{ |
|
65 |
table.PrimaryKey("PK_Users", x => x.Id); |
|
66 |
}); |
|
67 |
|
|
68 |
migrationBuilder.CreateTable( |
|
69 |
name: "Tags", |
|
70 |
columns: table => new |
|
71 |
{ |
|
72 |
Id = table.Column<Guid>(type: "uuid", nullable: false), |
|
73 |
CategoryId = table.Column<Guid>(type: "uuid", nullable: false), |
|
74 |
Name = table.Column<string>(type: "text", nullable: false), |
|
75 |
Description = table.Column<string>(type: "text", nullable: false), |
|
76 |
Color = table.Column<string>(type: "text", nullable: false) |
|
77 |
}, |
|
78 |
constraints: table => |
|
79 |
{ |
|
80 |
table.PrimaryKey("PK_Tags", x => x.Id); |
|
81 |
table.ForeignKey( |
|
82 |
name: "FK_Tags_TagCategories_CategoryId", |
|
83 |
column: x => x.CategoryId, |
|
84 |
principalTable: "TagCategories", |
|
85 |
principalColumn: "Id", |
|
86 |
onDelete: ReferentialAction.Cascade); |
|
87 |
}); |
|
88 |
|
|
89 |
migrationBuilder.CreateTable( |
|
90 |
name: "Documents", |
|
91 |
columns: table => new |
|
92 |
{ |
|
93 |
Id = table.Column<Guid>(type: "uuid", nullable: false), |
|
94 |
Name = table.Column<string>(type: "text", nullable: false), |
|
95 |
Length = table.Column<int>(type: "integer", nullable: false), |
|
96 |
ContentId = table.Column<Guid>(type: "uuid", nullable: false), |
|
97 |
DateAdded = table.Column<DateTime>(type: "timestamp with time zone", nullable: false), |
|
98 |
UserAddedId = table.Column<Guid>(type: "uuid", nullable: false), |
|
99 |
RequiredAnnotations = table.Column<int>(type: "integer", nullable: false) |
|
100 |
}, |
|
101 |
constraints: table => |
|
102 |
{ |
|
103 |
table.PrimaryKey("PK_Documents", x => x.Id); |
|
104 |
table.ForeignKey( |
|
105 |
name: "FK_Documents_DocumentContents_ContentId", |
|
106 |
column: x => x.ContentId, |
|
107 |
principalTable: "DocumentContents", |
|
108 |
principalColumn: "Id", |
|
109 |
onDelete: ReferentialAction.Cascade); |
|
110 |
table.ForeignKey( |
|
111 |
name: "FK_Documents_Users_UserAddedId", |
|
112 |
column: x => x.UserAddedId, |
|
113 |
principalTable: "Users", |
|
114 |
principalColumn: "Id", |
|
115 |
onDelete: ReferentialAction.Cascade); |
|
116 |
}); |
|
117 |
|
|
118 |
migrationBuilder.CreateTable( |
|
119 |
name: "SubTags", |
|
120 |
columns: table => new |
|
121 |
{ |
|
122 |
Id = table.Column<Guid>(type: "uuid", nullable: false), |
|
123 |
Name = table.Column<string>(type: "text", nullable: false), |
|
124 |
Description = table.Column<string>(type: "text", nullable: false), |
|
125 |
TagId = table.Column<Guid>(type: "uuid", nullable: false) |
|
126 |
}, |
|
127 |
constraints: table => |
|
128 |
{ |
|
129 |
table.PrimaryKey("PK_SubTags", x => x.Id); |
|
130 |
table.ForeignKey( |
|
131 |
name: "FK_SubTags_Tags_TagId", |
|
132 |
column: x => x.TagId, |
|
133 |
principalTable: "Tags", |
|
134 |
principalColumn: "Id", |
|
135 |
onDelete: ReferentialAction.Cascade); |
|
136 |
}); |
|
137 |
|
|
138 |
migrationBuilder.CreateTable( |
|
139 |
name: "Annotations", |
|
140 |
columns: table => new |
|
141 |
{ |
|
142 |
Id = table.Column<Guid>(type: "uuid", nullable: false), |
|
143 |
DocumentId = table.Column<Guid>(type: "uuid", nullable: false), |
|
144 |
UserId = table.Column<Guid>(type: "uuid", nullable: false), |
|
145 |
UserAssignedId = table.Column<Guid>(type: "uuid", nullable: false), |
|
146 |
DateAssigned = table.Column<DateTime>(type: "timestamp with time zone", nullable: false), |
|
147 |
State = table.Column<int>(type: "integer", nullable: false), |
|
148 |
DateLastChanged = table.Column<DateTime>(type: "timestamp with time zone", nullable: false), |
|
149 |
Note = table.Column<string>(type: "text", nullable: false) |
|
150 |
}, |
|
151 |
constraints: table => |
|
152 |
{ |
|
153 |
table.PrimaryKey("PK_Annotations", x => x.Id); |
|
154 |
table.ForeignKey( |
|
155 |
name: "FK_Annotations_Documents_DocumentId", |
|
156 |
column: x => x.DocumentId, |
|
157 |
principalTable: "Documents", |
|
158 |
principalColumn: "Id", |
|
159 |
onDelete: ReferentialAction.Cascade); |
|
160 |
table.ForeignKey( |
|
161 |
name: "FK_Annotations_Users_UserAssignedId", |
|
162 |
column: x => x.UserAssignedId, |
|
163 |
principalTable: "Users", |
|
164 |
principalColumn: "Id", |
|
165 |
onDelete: ReferentialAction.Cascade); |
|
166 |
table.ForeignKey( |
|
167 |
name: "FK_Annotations_Users_UserId", |
|
168 |
column: x => x.UserId, |
|
169 |
principalTable: "Users", |
|
170 |
principalColumn: "Id", |
|
171 |
onDelete: ReferentialAction.Cascade); |
|
172 |
}); |
|
173 |
|
|
174 |
migrationBuilder.CreateTable( |
|
175 |
name: "AnnotationClass", |
|
176 |
columns: table => new |
|
177 |
{ |
|
178 |
AnnotationsId = table.Column<Guid>(type: "uuid", nullable: false), |
|
179 |
ClassesId = table.Column<Guid>(type: "uuid", nullable: false) |
|
180 |
}, |
|
181 |
constraints: table => |
|
182 |
{ |
|
183 |
table.PrimaryKey("PK_AnnotationClass", x => new { x.AnnotationsId, x.ClassesId }); |
|
184 |
table.ForeignKey( |
|
185 |
name: "FK_AnnotationClass_Annotations_AnnotationsId", |
|
186 |
column: x => x.AnnotationsId, |
|
187 |
principalTable: "Annotations", |
|
188 |
principalColumn: "Id", |
|
189 |
onDelete: ReferentialAction.Cascade); |
|
190 |
table.ForeignKey( |
|
191 |
name: "FK_AnnotationClass_Classes_ClassesId", |
|
192 |
column: x => x.ClassesId, |
|
193 |
principalTable: "Classes", |
|
194 |
principalColumn: "Id", |
|
195 |
onDelete: ReferentialAction.Cascade); |
|
196 |
}); |
|
197 |
|
|
198 |
migrationBuilder.CreateTable( |
|
199 |
name: "AnnotationTags", |
|
200 |
columns: table => new |
|
201 |
{ |
|
202 |
Id = table.Column<Guid>(type: "uuid", nullable: false), |
|
203 |
AnnotationId = table.Column<Guid>(type: "uuid", nullable: false), |
|
204 |
TagId = table.Column<Guid>(type: "uuid", nullable: false), |
|
205 |
SubTagId = table.Column<Guid>(type: "uuid", nullable: true), |
|
206 |
Instance = table.Column<int>(type: "integer", nullable: false), |
|
207 |
Note = table.Column<string>(type: "text", nullable: false), |
|
208 |
Position = table.Column<int>(type: "integer", nullable: false), |
|
209 |
Length = table.Column<int>(type: "integer", nullable: false) |
|
210 |
}, |
|
211 |
constraints: table => |
|
212 |
{ |
|
213 |
table.PrimaryKey("PK_AnnotationTags", x => x.Id); |
|
214 |
table.ForeignKey( |
|
215 |
name: "FK_AnnotationTags_Annotations_AnnotationId", |
|
216 |
column: x => x.AnnotationId, |
|
217 |
principalTable: "Annotations", |
|
218 |
principalColumn: "Id", |
|
219 |
onDelete: ReferentialAction.Cascade); |
|
220 |
table.ForeignKey( |
|
221 |
name: "FK_AnnotationTags_SubTags_SubTagId", |
|
222 |
column: x => x.SubTagId, |
|
223 |
principalTable: "SubTags", |
|
224 |
principalColumn: "Id"); |
|
225 |
table.ForeignKey( |
|
226 |
name: "FK_AnnotationTags_Tags_TagId", |
|
227 |
column: x => x.TagId, |
|
228 |
principalTable: "Tags", |
|
229 |
principalColumn: "Id", |
|
230 |
onDelete: ReferentialAction.Cascade); |
|
231 |
}); |
|
232 |
|
|
233 |
migrationBuilder.CreateIndex( |
|
234 |
name: "IX_AnnotationClass_ClassesId", |
|
235 |
table: "AnnotationClass", |
|
236 |
column: "ClassesId"); |
|
237 |
|
|
238 |
migrationBuilder.CreateIndex( |
|
239 |
name: "IX_Annotations_DocumentId", |
|
240 |
table: "Annotations", |
|
241 |
column: "DocumentId"); |
|
242 |
|
|
243 |
migrationBuilder.CreateIndex( |
|
244 |
name: "IX_Annotations_UserAssignedId", |
|
245 |
table: "Annotations", |
|
246 |
column: "UserAssignedId"); |
|
247 |
|
|
248 |
migrationBuilder.CreateIndex( |
|
249 |
name: "IX_Annotations_UserId", |
|
250 |
table: "Annotations", |
|
251 |
column: "UserId"); |
|
252 |
|
|
253 |
migrationBuilder.CreateIndex( |
|
254 |
name: "IX_AnnotationTags_AnnotationId", |
|
255 |
table: "AnnotationTags", |
|
256 |
column: "AnnotationId"); |
|
257 |
|
|
258 |
migrationBuilder.CreateIndex( |
|
259 |
name: "IX_AnnotationTags_SubTagId", |
|
260 |
table: "AnnotationTags", |
|
261 |
column: "SubTagId"); |
|
262 |
|
|
263 |
migrationBuilder.CreateIndex( |
|
264 |
name: "IX_AnnotationTags_TagId", |
|
265 |
table: "AnnotationTags", |
|
266 |
column: "TagId"); |
|
267 |
|
|
268 |
migrationBuilder.CreateIndex( |
|
269 |
name: "IX_Documents_ContentId", |
|
270 |
table: "Documents", |
|
271 |
column: "ContentId"); |
|
272 |
|
|
273 |
migrationBuilder.CreateIndex( |
|
274 |
name: "IX_Documents_UserAddedId", |
|
275 |
table: "Documents", |
|
276 |
column: "UserAddedId"); |
|
277 |
|
|
278 |
migrationBuilder.CreateIndex( |
|
279 |
name: "IX_SubTags_TagId", |
|
280 |
table: "SubTags", |
|
281 |
column: "TagId"); |
|
282 |
|
|
283 |
migrationBuilder.CreateIndex( |
|
284 |
name: "IX_Tags_CategoryId", |
|
285 |
table: "Tags", |
|
286 |
column: "CategoryId"); |
|
287 |
} |
|
288 |
|
|
289 |
protected override void Down(MigrationBuilder migrationBuilder) |
|
290 |
{ |
|
291 |
migrationBuilder.DropTable( |
|
292 |
name: "AnnotationClass"); |
|
293 |
|
|
294 |
migrationBuilder.DropTable( |
|
295 |
name: "AnnotationTags"); |
|
296 |
|
|
297 |
migrationBuilder.DropTable( |
|
298 |
name: "Classes"); |
|
299 |
|
|
300 |
migrationBuilder.DropTable( |
|
301 |
name: "Annotations"); |
|
302 |
|
|
303 |
migrationBuilder.DropTable( |
|
304 |
name: "SubTags"); |
|
305 |
|
|
306 |
migrationBuilder.DropTable( |
|
307 |
name: "Documents"); |
|
308 |
|
|
309 |
migrationBuilder.DropTable( |
|
310 |
name: "Tags"); |
|
311 |
|
|
312 |
migrationBuilder.DropTable( |
|
313 |
name: "DocumentContents"); |
|
314 |
|
|
315 |
migrationBuilder.DropTable( |
|
316 |
name: "Users"); |
|
317 |
|
|
318 |
migrationBuilder.DropTable( |
|
319 |
name: "TagCategories"); |
|
320 |
} |
|
321 |
} |
|
322 |
} |
Backend/Backend/Migrations/20220417114429_V3.Designer.cs | ||
---|---|---|
1 |
// <auto-generated /> |
|
2 |
using System; |
|
3 |
using Core.Contexts; |
|
4 |
using Microsoft.EntityFrameworkCore; |
|
5 |
using Microsoft.EntityFrameworkCore.Infrastructure; |
|
6 |
using Microsoft.EntityFrameworkCore.Migrations; |
|
7 |
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; |
|
8 |
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; |
|
9 |
|
|
10 |
#nullable disable |
|
11 |
|
|
12 |
namespace RestAPI.Migrations |
|
13 |
{ |
|
14 |
[DbContext(typeof(DatabaseContext))] |
|
15 |
[Migration("20220417114429_V3")] |
|
16 |
partial class V3 |
|
17 |
{ |
|
18 |
protected override void BuildTargetModel(ModelBuilder modelBuilder) |
|
19 |
{ |
|
20 |
#pragma warning disable 612, 618 |
|
21 |
modelBuilder |
|
22 |
.HasAnnotation("ProductVersion", "6.0.3") |
|
23 |
.HasAnnotation("Relational:MaxIdentifierLength", 63); |
|
24 |
|
|
25 |
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); |
|
26 |
|
|
27 |
modelBuilder.Entity("AnnotationClass", b => |
|
28 |
{ |
|
29 |
b.Property<Guid>("AnnotationsId") |
|
30 |
.HasColumnType("uuid"); |
|
31 |
|
|
32 |
b.Property<Guid>("ClassesId") |
|
33 |
.HasColumnType("uuid"); |
|
34 |
|
|
35 |
b.HasKey("AnnotationsId", "ClassesId"); |
|
36 |
|
|
37 |
b.HasIndex("ClassesId"); |
|
38 |
|
|
39 |
b.ToTable("AnnotationClass"); |
|
40 |
}); |
|
41 |
|
|
42 |
modelBuilder.Entity("Core.Entities.Annotation", b => |
|
43 |
{ |
|
44 |
b.Property<Guid>("Id") |
|
45 |
.ValueGeneratedOnAdd() |
|
46 |
.HasColumnType("uuid"); |
|
47 |
|
|
48 |
b.Property<DateTime>("DateAssigned") |
|
49 |
.HasColumnType("timestamp with time zone"); |
|
50 |
|
|
51 |
b.Property<DateTime>("DateLastChanged") |
|
52 |
.HasColumnType("timestamp with time zone"); |
|
53 |
|
|
54 |
b.Property<Guid>("DocumentId") |
|
55 |
.HasColumnType("uuid"); |
|
56 |
|
|
57 |
b.Property<string>("Note") |
|
58 |
.IsRequired() |
|
59 |
.HasColumnType("text"); |
|
60 |
|
|
61 |
b.Property<int>("State") |
|
62 |
.HasColumnType("integer"); |
|
63 |
|
|
64 |
b.Property<Guid>("UserAssignedId") |
|
65 |
.HasColumnType("uuid"); |
|
66 |
|
|
67 |
b.Property<Guid>("UserId") |
|
68 |
.HasColumnType("uuid"); |
|
69 |
|
|
70 |
b.HasKey("Id"); |
|
71 |
|
|
72 |
b.HasIndex("DocumentId"); |
|
73 |
|
|
74 |
b.HasIndex("UserAssignedId"); |
|
75 |
|
|
76 |
b.HasIndex("UserId"); |
|
77 |
|
|
78 |
b.ToTable("Annotations"); |
|
79 |
}); |
|
80 |
|
|
81 |
modelBuilder.Entity("Core.Entities.AnnotationTag", b => |
|
82 |
{ |
|
83 |
b.Property<Guid>("Id") |
|
84 |
.ValueGeneratedOnAdd() |
|
85 |
.HasColumnType("uuid"); |
|
86 |
|
|
87 |
b.Property<Guid>("AnnotationId") |
|
88 |
.HasColumnType("uuid"); |
|
89 |
|
|
90 |
b.Property<Guid>("Instance") |
|
91 |
.HasColumnType("uuid"); |
|
92 |
|
|
93 |
b.Property<int>("Length") |
|
94 |
.HasColumnType("integer"); |
|
95 |
|
|
96 |
b.Property<string>("Note") |
|
97 |
.IsRequired() |
|
98 |
.HasColumnType("text"); |
|
99 |
|
|
100 |
b.Property<int>("Position") |
|
101 |
.HasColumnType("integer"); |
|
102 |
|
|
103 |
b.Property<Guid?>("SubTagId") |
|
104 |
.HasColumnType("uuid"); |
|
105 |
|
|
106 |
b.Property<Guid>("TagId") |
|
107 |
.HasColumnType("uuid"); |
|
108 |
|
|
109 |
b.HasKey("Id"); |
|
110 |
|
|
111 |
b.HasIndex("AnnotationId"); |
|
112 |
|
|
113 |
b.HasIndex("SubTagId"); |
|
114 |
|
|
115 |
b.HasIndex("TagId"); |
|
116 |
|
|
117 |
b.ToTable("AnnotationTags"); |
|
118 |
}); |
|
119 |
|
|
120 |
modelBuilder.Entity("Core.Entities.Class", b => |
|
121 |
{ |
|
122 |
b.Property<Guid>("Id") |
|
123 |
.ValueGeneratedOnAdd() |
|
124 |
.HasColumnType("uuid"); |
|
125 |
|
|
126 |
b.Property<string>("Color") |
|
127 |
.IsRequired() |
|
128 |
.HasColumnType("text"); |
|
129 |
|
|
130 |
b.Property<string>("Description") |
|
131 |
.IsRequired() |
|
132 |
.HasColumnType("text"); |
|
133 |
|
|
134 |
b.Property<string>("Name") |
|
135 |
.IsRequired() |
|
136 |
.HasColumnType("text"); |
|
137 |
|
|
138 |
b.HasKey("Id"); |
|
139 |
|
|
140 |
b.ToTable("Classes"); |
|
141 |
}); |
|
142 |
|
|
143 |
modelBuilder.Entity("Core.Entities.Document", b => |
|
144 |
{ |
|
145 |
b.Property<Guid>("Id") |
|
146 |
.ValueGeneratedOnAdd() |
|
147 |
.HasColumnType("uuid"); |
|
148 |
|
|
149 |
b.Property<Guid?>("ContentId") |
|
150 |
.HasColumnType("uuid"); |
|
151 |
|
|
152 |
b.Property<DateTime>("DateAdded") |
|
153 |
.HasColumnType("timestamp with time zone"); |
|
154 |
|
|
155 |
b.Property<int>("Length") |
|
156 |
.HasColumnType("integer"); |
|
157 |
|
|
158 |
b.Property<string>("Name") |
|
159 |
.HasColumnType("text"); |
|
160 |
|
|
161 |
b.Property<int>("RequiredAnnotations") |
|
162 |
.HasColumnType("integer"); |
|
163 |
|
|
164 |
b.Property<Guid?>("UserAddedId") |
|
165 |
.HasColumnType("uuid"); |
|
166 |
|
|
167 |
b.HasKey("Id"); |
|
168 |
|
|
169 |
b.HasIndex("ContentId"); |
|
170 |
|
|
171 |
b.HasIndex("UserAddedId"); |
|
172 |
|
|
173 |
b.ToTable("Documents"); |
|
174 |
}); |
|
175 |
|
|
176 |
modelBuilder.Entity("Core.Entities.DocumentContent", b => |
|
177 |
{ |
|
178 |
b.Property<Guid>("Id") |
|
179 |
.ValueGeneratedOnAdd() |
|
180 |
.HasColumnType("uuid"); |
|
181 |
|
|
182 |
b.Property<string>("Content") |
|
183 |
.IsRequired() |
|
184 |
.HasColumnType("text"); |
|
185 |
|
|
186 |
b.HasKey("Id"); |
|
187 |
|
|
188 |
b.ToTable("DocumentContents"); |
|
189 |
}); |
|
190 |
|
|
191 |
modelBuilder.Entity("Core.Entities.SubTag", b => |
|
192 |
{ |
|
193 |
b.Property<Guid>("Id") |
|
194 |
.ValueGeneratedOnAdd() |
|
195 |
.HasColumnType("uuid"); |
|
196 |
|
|
197 |
b.Property<string>("Description") |
|
198 |
.IsRequired() |
|
199 |
.HasColumnType("text"); |
|
200 |
|
|
201 |
b.Property<string>("Name") |
|
202 |
.IsRequired() |
|
203 |
.HasColumnType("text"); |
|
204 |
|
|
205 |
b.Property<Guid>("TagId") |
|
206 |
.HasColumnType("uuid"); |
|
207 |
|
|
208 |
b.HasKey("Id"); |
|
209 |
|
|
210 |
b.HasIndex("TagId"); |
|
211 |
|
|
212 |
b.ToTable("SubTags"); |
|
213 |
}); |
|
214 |
|
|
215 |
modelBuilder.Entity("Core.Entities.Tag", b => |
|
216 |
{ |
|
217 |
b.Property<Guid>("Id") |
|
218 |
.ValueGeneratedOnAdd() |
|
219 |
.HasColumnType("uuid"); |
|
220 |
|
|
221 |
b.Property<Guid>("CategoryId") |
|
222 |
.HasColumnType("uuid"); |
|
223 |
|
|
224 |
b.Property<string>("Color") |
|
225 |
.IsRequired() |
|
226 |
.HasColumnType("text"); |
|
227 |
|
|
228 |
b.Property<string>("Description") |
|
229 |
.IsRequired() |
|
230 |
.HasColumnType("text"); |
|
231 |
|
|
232 |
b.Property<string>("Name") |
|
233 |
.IsRequired() |
|
234 |
.HasColumnType("text"); |
|
235 |
|
|
236 |
b.HasKey("Id"); |
|
237 |
|
|
238 |
b.HasIndex("CategoryId"); |
|
239 |
|
|
240 |
b.ToTable("Tags"); |
|
241 |
}); |
|
242 |
|
|
243 |
modelBuilder.Entity("Core.Entities.TagCategory", b => |
|
244 |
{ |
|
245 |
b.Property<Guid>("Id") |
|
246 |
.ValueGeneratedOnAdd() |
|
247 |
.HasColumnType("uuid"); |
|
248 |
|
|
249 |
b.Property<string>("Color") |
|
250 |
.HasColumnType("text"); |
|
251 |
|
|
252 |
b.Property<string>("Description") |
|
253 |
.HasColumnType("text"); |
|
254 |
|
|
255 |
b.Property<string>("Name") |
|
256 |
.HasColumnType("text"); |
|
257 |
|
|
258 |
b.HasKey("Id"); |
|
259 |
|
|
260 |
b.ToTable("TagCategories"); |
|
261 |
}); |
|
262 |
|
|
263 |
modelBuilder.Entity("Core.Entities.User", b => |
|
264 |
{ |
|
265 |
b.Property<Guid>("Id") |
|
266 |
.ValueGeneratedOnAdd() |
|
267 |
.HasColumnType("uuid"); |
|
268 |
|
|
269 |
b.Property<string>("Name") |
|
270 |
.HasColumnType("text"); |
|
271 |
|
|
272 |
b.Property<string>("Password") |
|
273 |
.HasColumnType("text"); |
|
274 |
|
|
275 |
b.Property<int>("Role") |
|
276 |
.HasColumnType("integer"); |
|
277 |
|
|
278 |
b.Property<string>("Surname") |
|
279 |
.HasColumnType("text"); |
|
280 |
|
|
281 |
b.Property<string>("Username") |
|
282 |
.HasColumnType("text"); |
|
283 |
|
|
284 |
b.HasKey("Id"); |
|
285 |
|
|
286 |
b.ToTable("Users"); |
|
287 |
}); |
|
288 |
|
|
289 |
modelBuilder.Entity("AnnotationClass", b => |
|
290 |
{ |
|
291 |
b.HasOne("Core.Entities.Annotation", null) |
|
292 |
.WithMany() |
|
293 |
.HasForeignKey("AnnotationsId") |
|
294 |
.OnDelete(DeleteBehavior.Cascade) |
|
295 |
.IsRequired(); |
|
296 |
|
|
297 |
b.HasOne("Core.Entities.Class", null) |
|
298 |
.WithMany() |
|
299 |
.HasForeignKey("ClassesId") |
|
300 |
.OnDelete(DeleteBehavior.Cascade) |
|
301 |
.IsRequired(); |
|
302 |
}); |
|
303 |
|
|
304 |
modelBuilder.Entity("Core.Entities.Annotation", b => |
|
305 |
{ |
|
306 |
b.HasOne("Core.Entities.Document", "Document") |
|
307 |
.WithMany() |
|
308 |
.HasForeignKey("DocumentId") |
|
309 |
.OnDelete(DeleteBehavior.Cascade) |
|
310 |
.IsRequired(); |
|
311 |
|
|
312 |
b.HasOne("Core.Entities.User", "UserAssigned") |
|
313 |
.WithMany() |
|
314 |
.HasForeignKey("UserAssignedId") |
|
315 |
.OnDelete(DeleteBehavior.Cascade) |
|
316 |
.IsRequired(); |
|
317 |
|
|
318 |
b.HasOne("Core.Entities.User", "User") |
|
319 |
.WithMany() |
|
320 |
.HasForeignKey("UserId") |
|
321 |
.OnDelete(DeleteBehavior.Cascade) |
|
322 |
.IsRequired(); |
|
323 |
|
|
324 |
b.Navigation("Document"); |
|
325 |
|
|
326 |
b.Navigation("User"); |
|
327 |
|
|
328 |
b.Navigation("UserAssigned"); |
|
329 |
}); |
|
330 |
|
|
331 |
modelBuilder.Entity("Core.Entities.AnnotationTag", b => |
|
332 |
{ |
|
333 |
b.HasOne("Core.Entities.Annotation", "Annotation") |
|
334 |
.WithMany() |
|
335 |
.HasForeignKey("AnnotationId") |
|
336 |
.OnDelete(DeleteBehavior.Cascade) |
|
337 |
.IsRequired(); |
|
338 |
|
|
339 |
b.HasOne("Core.Entities.SubTag", "SubTag") |
|
340 |
.WithMany() |
|
341 |
.HasForeignKey("SubTagId"); |
|
342 |
|
|
343 |
b.HasOne("Core.Entities.Tag", "Tag") |
|
344 |
.WithMany() |
|
345 |
.HasForeignKey("TagId") |
|
346 |
.OnDelete(DeleteBehavior.Cascade) |
|
347 |
.IsRequired(); |
|
348 |
|
|
349 |
b.Navigation("Annotation"); |
|
350 |
|
|
351 |
b.Navigation("SubTag"); |
|
352 |
|
|
353 |
b.Navigation("Tag"); |
|
354 |
}); |
|
355 |
|
|
356 |
modelBuilder.Entity("Core.Entities.Document", b => |
|
357 |
{ |
|
358 |
b.HasOne("Core.Entities.DocumentContent", "Content") |
|
359 |
.WithMany() |
|
360 |
.HasForeignKey("ContentId"); |
|
361 |
|
|
362 |
b.HasOne("Core.Entities.User", "UserAdded") |
|
363 |
.WithMany() |
|
364 |
.HasForeignKey("UserAddedId"); |
|
365 |
|
|
366 |
b.Navigation("Content"); |
|
367 |
|
|
368 |
b.Navigation("UserAdded"); |
|
369 |
}); |
|
370 |
|
|
371 |
modelBuilder.Entity("Core.Entities.SubTag", b => |
|
372 |
{ |
|
373 |
b.HasOne("Core.Entities.Tag", "Tag") |
|
374 |
.WithMany() |
|
375 |
.HasForeignKey("TagId") |
|
376 |
.OnDelete(DeleteBehavior.Cascade) |
|
377 |
.IsRequired(); |
|
378 |
|
|
379 |
b.Navigation("Tag"); |
|
380 |
}); |
|
381 |
|
|
382 |
modelBuilder.Entity("Core.Entities.Tag", b => |
|
383 |
{ |
|
384 |
b.HasOne("Core.Entities.TagCategory", "Category") |
|
385 |
.WithMany() |
|
386 |
.HasForeignKey("CategoryId") |
|
387 |
.OnDelete(DeleteBehavior.Cascade) |
|
388 |
.IsRequired(); |
|
389 |
|
|
390 |
b.Navigation("Category"); |
|
391 |
}); |
|
392 |
#pragma warning restore 612, 618 |
|
393 |
} |
|
394 |
} |
|
395 |
} |
Backend/Backend/Migrations/20220417114429_V3.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using Microsoft.EntityFrameworkCore.Migrations; |
|
3 |
|
|
4 |
#nullable disable |
|
5 |
|
|
6 |
namespace RestAPI.Migrations |
|
7 |
{ |
|
8 |
public partial class V3 : Migration |
|
9 |
{ |
|
10 |
protected override void Up(MigrationBuilder migrationBuilder) |
|
11 |
{ |
|
12 |
migrationBuilder.DropForeignKey( |
|
13 |
name: "FK_Documents_DocumentContents_ContentId", |
|
14 |
table: "Documents"); |
|
15 |
|
|
16 |
migrationBuilder.DropForeignKey( |
|
17 |
name: "FK_Documents_Users_UserAddedId", |
|
18 |
table: "Documents"); |
|
19 |
|
|
20 |
migrationBuilder.AlterColumn<string>( |
|
21 |
name: "Username", |
|
22 |
table: "Users", |
|
23 |
type: "text", |
|
24 |
nullable: true, |
|
25 |
oldClrType: typeof(string), |
|
26 |
oldType: "text"); |
|
27 |
|
|
28 |
migrationBuilder.AlterColumn<string>( |
|
29 |
name: "Surname", |
|
30 |
table: "Users", |
|
31 |
type: "text", |
|
32 |
nullable: true, |
|
33 |
oldClrType: typeof(string), |
|
34 |
oldType: "text"); |
|
35 |
|
|
36 |
migrationBuilder.AlterColumn<string>( |
|
37 |
name: "Password", |
|
38 |
table: "Users", |
|
39 |
type: "text", |
|
40 |
nullable: true, |
|
41 |
oldClrType: typeof(string), |
|
42 |
oldType: "text"); |
|
43 |
|
|
44 |
migrationBuilder.AlterColumn<string>( |
|
45 |
name: "Name", |
|
46 |
table: "Users", |
|
47 |
type: "text", |
|
48 |
nullable: true, |
|
49 |
oldClrType: typeof(string), |
|
50 |
oldType: "text"); |
|
51 |
|
|
52 |
migrationBuilder.AlterColumn<string>( |
|
53 |
name: "Name", |
|
54 |
table: "TagCategories", |
|
55 |
type: "text", |
|
56 |
nullable: true, |
|
57 |
oldClrType: typeof(string), |
|
58 |
oldType: "text"); |
|
59 |
|
|
60 |
migrationBuilder.AlterColumn<string>( |
|
61 |
name: "Description", |
|
62 |
table: "TagCategories", |
|
63 |
type: "text", |
|
64 |
nullable: true, |
|
65 |
oldClrType: typeof(string), |
|
66 |
oldType: "text"); |
|
67 |
|
|
68 |
migrationBuilder.AlterColumn<string>( |
|
69 |
name: "Color", |
|
70 |
table: "TagCategories", |
|
71 |
type: "text", |
|
72 |
nullable: true, |
|
73 |
oldClrType: typeof(string), |
|
74 |
oldType: "text"); |
|
75 |
|
|
76 |
migrationBuilder.AlterColumn<Guid>( |
|
77 |
name: "UserAddedId", |
|
78 |
table: "Documents", |
|
79 |
type: "uuid", |
|
80 |
nullable: true, |
|
81 |
oldClrType: typeof(Guid), |
|
82 |
oldType: "uuid"); |
|
83 |
|
|
84 |
migrationBuilder.AlterColumn<string>( |
|
85 |
name: "Name", |
|
86 |
table: "Documents", |
|
87 |
type: "text", |
|
88 |
nullable: true, |
|
89 |
oldClrType: typeof(string), |
|
90 |
oldType: "text"); |
|
91 |
|
|
92 |
migrationBuilder.AlterColumn<Guid>( |
|
93 |
name: "ContentId", |
|
94 |
table: "Documents", |
|
95 |
type: "uuid", |
|
96 |
nullable: true, |
|
97 |
oldClrType: typeof(Guid), |
|
98 |
oldType: "uuid"); |
|
99 |
|
|
100 |
migrationBuilder.AlterColumn<Guid>( |
|
101 |
name: "Instance", |
|
102 |
table: "AnnotationTags", |
|
103 |
type: "uuid", |
|
104 |
nullable: false, |
|
105 |
oldClrType: typeof(int), |
|
106 |
oldType: "integer"); |
|
107 |
|
|
108 |
migrationBuilder.AddForeignKey( |
|
109 |
name: "FK_Documents_DocumentContents_ContentId", |
|
110 |
table: "Documents", |
|
111 |
column: "ContentId", |
|
112 |
principalTable: "DocumentContents", |
|
113 |
principalColumn: "Id"); |
|
114 |
|
|
115 |
migrationBuilder.AddForeignKey( |
|
116 |
name: "FK_Documents_Users_UserAddedId", |
|
117 |
table: "Documents", |
|
118 |
column: "UserAddedId", |
|
119 |
principalTable: "Users", |
|
120 |
principalColumn: "Id"); |
|
121 |
} |
|
122 |
|
|
123 |
protected override void Down(MigrationBuilder migrationBuilder) |
|
124 |
{ |
|
125 |
migrationBuilder.DropForeignKey( |
|
126 |
name: "FK_Documents_DocumentContents_ContentId", |
|
127 |
table: "Documents"); |
|
128 |
|
|
129 |
migrationBuilder.DropForeignKey( |
|
130 |
name: "FK_Documents_Users_UserAddedId", |
|
131 |
table: "Documents"); |
|
132 |
|
|
133 |
migrationBuilder.AlterColumn<string>( |
|
134 |
name: "Username", |
|
135 |
table: "Users", |
|
136 |
type: "text", |
|
137 |
nullable: false, |
|
138 |
defaultValue: "", |
|
139 |
oldClrType: typeof(string), |
|
140 |
oldType: "text", |
|
141 |
oldNullable: true); |
|
142 |
|
|
143 |
migrationBuilder.AlterColumn<string>( |
|
144 |
name: "Surname", |
|
145 |
table: "Users", |
|
146 |
type: "text", |
|
147 |
nullable: false, |
|
148 |
defaultValue: "", |
|
149 |
oldClrType: typeof(string), |
|
150 |
oldType: "text", |
|
151 |
oldNullable: true); |
|
152 |
|
|
153 |
migrationBuilder.AlterColumn<string>( |
|
154 |
name: "Password", |
|
155 |
table: "Users", |
|
156 |
type: "text", |
|
157 |
nullable: false, |
|
158 |
defaultValue: "", |
|
159 |
oldClrType: typeof(string), |
|
160 |
oldType: "text", |
|
161 |
oldNullable: true); |
|
162 |
|
|
163 |
migrationBuilder.AlterColumn<string>( |
|
164 |
name: "Name", |
|
165 |
table: "Users", |
|
166 |
type: "text", |
|
167 |
nullable: false, |
|
168 |
defaultValue: "", |
|
169 |
oldClrType: typeof(string), |
|
170 |
oldType: "text", |
|
171 |
oldNullable: true); |
|
172 |
|
|
173 |
migrationBuilder.AlterColumn<string>( |
|
174 |
name: "Name", |
|
175 |
table: "TagCategories", |
|
176 |
type: "text", |
|
177 |
nullable: false, |
|
178 |
defaultValue: "", |
|
179 |
oldClrType: typeof(string), |
|
180 |
oldType: "text", |
|
181 |
oldNullable: true); |
|
182 |
|
|
183 |
migrationBuilder.AlterColumn<string>( |
|
184 |
name: "Description", |
|
185 |
table: "TagCategories", |
|
186 |
type: "text", |
|
187 |
nullable: false, |
|
188 |
defaultValue: "", |
|
189 |
oldClrType: typeof(string), |
|
190 |
oldType: "text", |
|
191 |
oldNullable: true); |
|
192 |
|
|
193 |
migrationBuilder.AlterColumn<string>( |
|
194 |
name: "Color", |
|
195 |
table: "TagCategories", |
|
196 |
type: "text", |
|
197 |
nullable: false, |
|
198 |
defaultValue: "", |
|
199 |
oldClrType: typeof(string), |
|
200 |
oldType: "text", |
|
201 |
oldNullable: true); |
|
202 |
|
|
203 |
migrationBuilder.AlterColumn<Guid>( |
|
204 |
name: "UserAddedId", |
|
205 |
table: "Documents", |
|
206 |
type: "uuid", |
|
207 |
nullable: false, |
|
208 |
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), |
|
209 |
oldClrType: typeof(Guid), |
|
210 |
oldType: "uuid", |
|
211 |
oldNullable: true); |
|
212 |
|
|
213 |
migrationBuilder.AlterColumn<string>( |
|
214 |
name: "Name", |
|
215 |
table: "Documents", |
|
216 |
type: "text", |
|
217 |
nullable: false, |
|
218 |
defaultValue: "", |
|
219 |
oldClrType: typeof(string), |
|
220 |
oldType: "text", |
|
221 |
oldNullable: true); |
|
222 |
|
|
223 |
migrationBuilder.AlterColumn<Guid>( |
|
224 |
name: "ContentId", |
|
225 |
table: "Documents", |
|
226 |
type: "uuid", |
|
227 |
nullable: false, |
|
228 |
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), |
|
229 |
oldClrType: typeof(Guid), |
|
230 |
oldType: "uuid", |
|
231 |
oldNullable: true); |
|
232 |
|
|
233 |
migrationBuilder.AlterColumn<int>( |
|
234 |
name: "Instance", |
|
235 |
table: "AnnotationTags", |
|
236 |
type: "integer", |
|
237 |
nullable: false, |
|
238 |
oldClrType: typeof(Guid), |
|
239 |
oldType: "uuid"); |
|
240 |
|
|
241 |
migrationBuilder.AddForeignKey( |
|
242 |
name: "FK_Documents_DocumentContents_ContentId", |
|
243 |
table: "Documents", |
|
244 |
column: "ContentId", |
|
245 |
principalTable: "DocumentContents", |
|
246 |
principalColumn: "Id", |
|
247 |
onDelete: ReferentialAction.Cascade); |
|
248 |
|
|
249 |
migrationBuilder.AddForeignKey( |
|
250 |
name: "FK_Documents_Users_UserAddedId", |
|
251 |
table: "Documents", |
|
252 |
column: "UserAddedId", |
|
253 |
principalTable: "Users", |
|
254 |
principalColumn: "Id", |
|
255 |
onDelete: ReferentialAction.Cascade); |
|
256 |
} |
|
257 |
} |
|
258 |
} |
Backend/Backend/Migrations/20220427093145_V4.Designer.cs | ||
---|---|---|
1 |
// <auto-generated /> |
|
2 |
using System; |
|
3 |
using Core.Contexts; |
|
4 |
using Microsoft.EntityFrameworkCore; |
|
5 |
using Microsoft.EntityFrameworkCore.Infrastructure; |
|
6 |
using Microsoft.EntityFrameworkCore.Migrations; |
|
7 |
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; |
|
8 |
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; |
|
9 |
|
|
10 |
#nullable disable |
|
11 |
|
|
12 |
namespace RestAPI.Migrations |
|
13 |
{ |
|
14 |
[DbContext(typeof(DatabaseContext))] |
|
15 |
[Migration("20220427093145_V4")] |
|
16 |
partial class V4 |
|
17 |
{ |
|
18 |
protected override void BuildTargetModel(ModelBuilder modelBuilder) |
|
19 |
{ |
|
20 |
#pragma warning disable 612, 618 |
|
21 |
modelBuilder |
|
22 |
.HasAnnotation("ProductVersion", "6.0.3") |
|
23 |
.HasAnnotation("Relational:MaxIdentifierLength", 63); |
|
24 |
|
|
25 |
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); |
|
26 |
|
|
27 |
modelBuilder.Entity("AnnotationClass", b => |
|
28 |
{ |
|
29 |
b.Property<Guid>("AnnotationsId") |
|
30 |
.HasColumnType("uuid"); |
|
31 |
|
|
32 |
b.Property<Guid>("ClassesId") |
|
33 |
.HasColumnType("uuid"); |
|
34 |
|
|
35 |
b.HasKey("AnnotationsId", "ClassesId"); |
|
36 |
|
|
37 |
b.HasIndex("ClassesId"); |
|
38 |
|
|
39 |
b.ToTable("AnnotationClass"); |
|
40 |
}); |
|
41 |
|
|
42 |
modelBuilder.Entity("Core.Entities.Annotation", b => |
|
43 |
{ |
|
44 |
b.Property<Guid>("Id") |
|
45 |
.ValueGeneratedOnAdd() |
|
46 |
.HasColumnType("uuid"); |
|
47 |
|
|
48 |
b.Property<DateTime>("DateAssigned") |
|
49 |
.HasColumnType("timestamp with time zone"); |
|
50 |
|
|
51 |
b.Property<DateTime>("DateLastChanged") |
|
52 |
.HasColumnType("timestamp with time zone"); |
|
53 |
|
|
54 |
b.Property<Guid>("DocumentId") |
|
55 |
.HasColumnType("uuid"); |
|
56 |
|
|
57 |
b.Property<string>("Note") |
|
58 |
.IsRequired() |
|
59 |
.HasColumnType("text"); |
|
60 |
|
|
61 |
b.Property<int>("State") |
|
62 |
.HasColumnType("integer"); |
|
63 |
|
|
64 |
b.Property<Guid>("UserAssignedId") |
|
65 |
.HasColumnType("uuid"); |
|
66 |
|
|
67 |
b.Property<Guid>("UserId") |
|
68 |
.HasColumnType("uuid"); |
|
69 |
|
|
70 |
b.HasKey("Id"); |
|
71 |
|
|
72 |
b.HasIndex("DocumentId"); |
|
73 |
|
|
74 |
b.HasIndex("UserAssignedId"); |
|
75 |
|
|
76 |
b.HasIndex("UserId"); |
|
77 |
|
|
78 |
b.ToTable("Annotations"); |
|
79 |
}); |
|
80 |
|
|
81 |
modelBuilder.Entity("Core.Entities.AnnotationTag", b => |
|
82 |
{ |
|
83 |
b.Property<Guid>("Id") |
Také k dispozici: Unified diff
Added database migration