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
|
}
|