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("20220330134820_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<int>("AnnotationsId")
|
30
|
.HasColumnType("integer");
|
31
|
|
32
|
b.Property<int>("ClassesId")
|
33
|
.HasColumnType("integer");
|
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<int>("Id")
|
45
|
.ValueGeneratedOnAdd()
|
46
|
.HasColumnType("integer");
|
47
|
|
48
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
49
|
|
50
|
b.Property<DateTime>("DateAssigned")
|
51
|
.HasColumnType("timestamp with time zone");
|
52
|
|
53
|
b.Property<DateTime>("DateLastChanged")
|
54
|
.HasColumnType("timestamp with time zone");
|
55
|
|
56
|
b.Property<int>("DocumentId")
|
57
|
.HasColumnType("integer");
|
58
|
|
59
|
b.Property<string>("Note")
|
60
|
.IsRequired()
|
61
|
.HasColumnType("text");
|
62
|
|
63
|
b.Property<int>("State")
|
64
|
.HasColumnType("integer");
|
65
|
|
66
|
b.Property<int>("UserAssignedId")
|
67
|
.HasColumnType("integer");
|
68
|
|
69
|
b.Property<int>("UserId")
|
70
|
.HasColumnType("integer");
|
71
|
|
72
|
b.HasKey("Id");
|
73
|
|
74
|
b.HasIndex("DocumentId");
|
75
|
|
76
|
b.HasIndex("UserAssignedId");
|
77
|
|
78
|
b.HasIndex("UserId");
|
79
|
|
80
|
b.ToTable("Annotations");
|
81
|
});
|
82
|
|
83
|
modelBuilder.Entity("Core.Entities.AnnotationTag", b =>
|
84
|
{
|
85
|
b.Property<int>("Id")
|
86
|
.ValueGeneratedOnAdd()
|
87
|
.HasColumnType("integer");
|
88
|
|
89
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
90
|
|
91
|
b.Property<int>("AnnotationId")
|
92
|
.HasColumnType("integer");
|
93
|
|
94
|
b.Property<int>("Instance")
|
95
|
.HasColumnType("integer");
|
96
|
|
97
|
b.Property<int>("Length")
|
98
|
.HasColumnType("integer");
|
99
|
|
100
|
b.Property<string>("Note")
|
101
|
.IsRequired()
|
102
|
.HasColumnType("text");
|
103
|
|
104
|
b.Property<int>("Position")
|
105
|
.HasColumnType("integer");
|
106
|
|
107
|
b.Property<int>("SubTagId")
|
108
|
.HasColumnType("integer");
|
109
|
|
110
|
b.Property<int>("TagId")
|
111
|
.HasColumnType("integer");
|
112
|
|
113
|
b.HasKey("Id");
|
114
|
|
115
|
b.HasIndex("AnnotationId");
|
116
|
|
117
|
b.HasIndex("SubTagId");
|
118
|
|
119
|
b.HasIndex("TagId");
|
120
|
|
121
|
b.ToTable("AnnotationTags");
|
122
|
});
|
123
|
|
124
|
modelBuilder.Entity("Core.Entities.Class", b =>
|
125
|
{
|
126
|
b.Property<int>("Id")
|
127
|
.ValueGeneratedOnAdd()
|
128
|
.HasColumnType("integer");
|
129
|
|
130
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
131
|
|
132
|
b.Property<string>("Color")
|
133
|
.IsRequired()
|
134
|
.HasColumnType("text");
|
135
|
|
136
|
b.Property<string>("Description")
|
137
|
.IsRequired()
|
138
|
.HasColumnType("text");
|
139
|
|
140
|
b.Property<string>("Name")
|
141
|
.IsRequired()
|
142
|
.HasColumnType("text");
|
143
|
|
144
|
b.HasKey("Id");
|
145
|
|
146
|
b.ToTable("Classes");
|
147
|
});
|
148
|
|
149
|
modelBuilder.Entity("Core.Entities.Document", b =>
|
150
|
{
|
151
|
b.Property<int>("Id")
|
152
|
.ValueGeneratedOnAdd()
|
153
|
.HasColumnType("integer");
|
154
|
|
155
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
156
|
|
157
|
b.Property<int>("ContentId")
|
158
|
.HasColumnType("integer");
|
159
|
|
160
|
b.Property<DateTime>("DateAdded")
|
161
|
.HasColumnType("timestamp with time zone");
|
162
|
|
163
|
b.Property<int>("Length")
|
164
|
.HasColumnType("integer");
|
165
|
|
166
|
b.Property<string>("Name")
|
167
|
.IsRequired()
|
168
|
.HasColumnType("text");
|
169
|
|
170
|
b.Property<int>("RequiredAnnotations")
|
171
|
.HasColumnType("integer");
|
172
|
|
173
|
b.Property<int>("UserAddedId")
|
174
|
.HasColumnType("integer");
|
175
|
|
176
|
b.HasKey("Id");
|
177
|
|
178
|
b.HasIndex("ContentId");
|
179
|
|
180
|
b.HasIndex("UserAddedId");
|
181
|
|
182
|
b.ToTable("Documents");
|
183
|
});
|
184
|
|
185
|
modelBuilder.Entity("Core.Entities.DocumentContent", b =>
|
186
|
{
|
187
|
b.Property<int>("Id")
|
188
|
.ValueGeneratedOnAdd()
|
189
|
.HasColumnType("integer");
|
190
|
|
191
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
192
|
|
193
|
b.Property<string>("Content")
|
194
|
.IsRequired()
|
195
|
.HasColumnType("text");
|
196
|
|
197
|
b.HasKey("Id");
|
198
|
|
199
|
b.ToTable("DocumentContents");
|
200
|
});
|
201
|
|
202
|
modelBuilder.Entity("Core.Entities.SubTag", b =>
|
203
|
{
|
204
|
b.Property<int>("Id")
|
205
|
.ValueGeneratedOnAdd()
|
206
|
.HasColumnType("integer");
|
207
|
|
208
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
209
|
|
210
|
b.Property<string>("Description")
|
211
|
.IsRequired()
|
212
|
.HasColumnType("text");
|
213
|
|
214
|
b.Property<string>("Name")
|
215
|
.IsRequired()
|
216
|
.HasColumnType("text");
|
217
|
|
218
|
b.Property<int>("TagId")
|
219
|
.HasColumnType("integer");
|
220
|
|
221
|
b.HasKey("Id");
|
222
|
|
223
|
b.HasIndex("TagId");
|
224
|
|
225
|
b.ToTable("SubTags");
|
226
|
});
|
227
|
|
228
|
modelBuilder.Entity("Core.Entities.Tag", b =>
|
229
|
{
|
230
|
b.Property<int>("Id")
|
231
|
.ValueGeneratedOnAdd()
|
232
|
.HasColumnType("integer");
|
233
|
|
234
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
235
|
|
236
|
b.Property<int>("CategoryId")
|
237
|
.HasColumnType("integer");
|
238
|
|
239
|
b.Property<string>("Color")
|
240
|
.IsRequired()
|
241
|
.HasColumnType("text");
|
242
|
|
243
|
b.Property<string>("Description")
|
244
|
.IsRequired()
|
245
|
.HasColumnType("text");
|
246
|
|
247
|
b.Property<string>("Name")
|
248
|
.IsRequired()
|
249
|
.HasColumnType("text");
|
250
|
|
251
|
b.HasKey("Id");
|
252
|
|
253
|
b.HasIndex("CategoryId");
|
254
|
|
255
|
b.ToTable("Tags");
|
256
|
});
|
257
|
|
258
|
modelBuilder.Entity("Core.Entities.TagCategory", b =>
|
259
|
{
|
260
|
b.Property<int>("Id")
|
261
|
.ValueGeneratedOnAdd()
|
262
|
.HasColumnType("integer");
|
263
|
|
264
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
265
|
|
266
|
b.Property<string>("Color")
|
267
|
.IsRequired()
|
268
|
.HasColumnType("text");
|
269
|
|
270
|
b.Property<string>("Description")
|
271
|
.IsRequired()
|
272
|
.HasColumnType("text");
|
273
|
|
274
|
b.Property<string>("Name")
|
275
|
.IsRequired()
|
276
|
.HasColumnType("text");
|
277
|
|
278
|
b.HasKey("Id");
|
279
|
|
280
|
b.ToTable("TagCategories");
|
281
|
});
|
282
|
|
283
|
modelBuilder.Entity("Core.Entities.User", b =>
|
284
|
{
|
285
|
b.Property<int>("Id")
|
286
|
.ValueGeneratedOnAdd()
|
287
|
.HasColumnType("integer");
|
288
|
|
289
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
290
|
|
291
|
b.Property<string>("Name")
|
292
|
.IsRequired()
|
293
|
.HasColumnType("text");
|
294
|
|
295
|
b.Property<string>("Password")
|
296
|
.IsRequired()
|
297
|
.HasColumnType("text");
|
298
|
|
299
|
b.Property<int>("Role")
|
300
|
.HasColumnType("integer");
|
301
|
|
302
|
b.Property<string>("Surname")
|
303
|
.IsRequired()
|
304
|
.HasColumnType("text");
|
305
|
|
306
|
b.Property<string>("Username")
|
307
|
.IsRequired()
|
308
|
.HasColumnType("text");
|
309
|
|
310
|
b.HasKey("Id");
|
311
|
|
312
|
b.ToTable("Users");
|
313
|
});
|
314
|
|
315
|
modelBuilder.Entity("AnnotationClass", b =>
|
316
|
{
|
317
|
b.HasOne("Core.Entities.Annotation", null)
|
318
|
.WithMany()
|
319
|
.HasForeignKey("AnnotationsId")
|
320
|
.OnDelete(DeleteBehavior.Cascade)
|
321
|
.IsRequired();
|
322
|
|
323
|
b.HasOne("Core.Entities.Class", null)
|
324
|
.WithMany()
|
325
|
.HasForeignKey("ClassesId")
|
326
|
.OnDelete(DeleteBehavior.Cascade)
|
327
|
.IsRequired();
|
328
|
});
|
329
|
|
330
|
modelBuilder.Entity("Core.Entities.Annotation", b =>
|
331
|
{
|
332
|
b.HasOne("Core.Entities.Document", "Document")
|
333
|
.WithMany()
|
334
|
.HasForeignKey("DocumentId")
|
335
|
.OnDelete(DeleteBehavior.Cascade)
|
336
|
.IsRequired();
|
337
|
|
338
|
b.HasOne("Core.Entities.User", "UserAssigned")
|
339
|
.WithMany()
|
340
|
.HasForeignKey("UserAssignedId")
|
341
|
.OnDelete(DeleteBehavior.Cascade)
|
342
|
.IsRequired();
|
343
|
|
344
|
b.HasOne("Core.Entities.User", "User")
|
345
|
.WithMany()
|
346
|
.HasForeignKey("UserId")
|
347
|
.OnDelete(DeleteBehavior.Cascade)
|
348
|
.IsRequired();
|
349
|
|
350
|
b.Navigation("Document");
|
351
|
|
352
|
b.Navigation("User");
|
353
|
|
354
|
b.Navigation("UserAssigned");
|
355
|
});
|
356
|
|
357
|
modelBuilder.Entity("Core.Entities.AnnotationTag", b =>
|
358
|
{
|
359
|
b.HasOne("Core.Entities.Annotation", "Annotation")
|
360
|
.WithMany()
|
361
|
.HasForeignKey("AnnotationId")
|
362
|
.OnDelete(DeleteBehavior.Cascade)
|
363
|
.IsRequired();
|
364
|
|
365
|
b.HasOne("Core.Entities.SubTag", "SubTag")
|
366
|
.WithMany()
|
367
|
.HasForeignKey("SubTagId")
|
368
|
.OnDelete(DeleteBehavior.Cascade)
|
369
|
.IsRequired();
|
370
|
|
371
|
b.HasOne("Core.Entities.Tag", "Tag")
|
372
|
.WithMany()
|
373
|
.HasForeignKey("TagId")
|
374
|
.OnDelete(DeleteBehavior.Cascade)
|
375
|
.IsRequired();
|
376
|
|
377
|
b.Navigation("Annotation");
|
378
|
|
379
|
b.Navigation("SubTag");
|
380
|
|
381
|
b.Navigation("Tag");
|
382
|
});
|
383
|
|
384
|
modelBuilder.Entity("Core.Entities.Document", b =>
|
385
|
{
|
386
|
b.HasOne("Core.Entities.DocumentContent", "Content")
|
387
|
.WithMany()
|
388
|
.HasForeignKey("ContentId")
|
389
|
.OnDelete(DeleteBehavior.Cascade)
|
390
|
.IsRequired();
|
391
|
|
392
|
b.HasOne("Core.Entities.User", "UserAdded")
|
393
|
.WithMany()
|
394
|
.HasForeignKey("UserAddedId")
|
395
|
.OnDelete(DeleteBehavior.Cascade)
|
396
|
.IsRequired();
|
397
|
|
398
|
b.Navigation("Content");
|
399
|
|
400
|
b.Navigation("UserAdded");
|
401
|
});
|
402
|
|
403
|
modelBuilder.Entity("Core.Entities.SubTag", b =>
|
404
|
{
|
405
|
b.HasOne("Core.Entities.Tag", "Tag")
|
406
|
.WithMany()
|
407
|
.HasForeignKey("TagId")
|
408
|
.OnDelete(DeleteBehavior.Cascade)
|
409
|
.IsRequired();
|
410
|
|
411
|
b.Navigation("Tag");
|
412
|
});
|
413
|
|
414
|
modelBuilder.Entity("Core.Entities.Tag", b =>
|
415
|
{
|
416
|
b.HasOne("Core.Entities.TagCategory", "Category")
|
417
|
.WithMany()
|
418
|
.HasForeignKey("CategoryId")
|
419
|
.OnDelete(DeleteBehavior.Cascade)
|
420
|
.IsRequired();
|
421
|
|
422
|
b.Navigation("Category");
|
423
|
});
|
424
|
#pragma warning restore 612, 618
|
425
|
}
|
426
|
}
|
427
|
}
|