Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 9eaf8206

Přidáno uživatelem Vojtěch Bartička před asi 3 roky(ů)

Database migration added

Zobrazit rozdíly:

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")
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.ConfigurationItem", b =>
144
                {
145
                    b.Property<Guid>("Id")
146
                        .ValueGeneratedOnAdd()
147
                        .HasColumnType("uuid");
148

  
149
                    b.Property<string>("Key")
150
                        .IsRequired()
151
                        .HasColumnType("text");
152

  
153
                    b.Property<string>("Value")
154
                        .IsRequired()
155
                        .HasColumnType("text");
156

  
157
                    b.HasKey("Id");
158

  
159
                    b.ToTable("ConfigurationItems");
160
                });
161

  
162
            modelBuilder.Entity("Core.Entities.Document", b =>
163
                {
164
                    b.Property<Guid>("Id")
165
                        .ValueGeneratedOnAdd()
166
                        .HasColumnType("uuid");
167

  
168
                    b.Property<Guid?>("ContentId")
169
                        .HasColumnType("uuid");
170

  
171
                    b.Property<DateTime>("DateAdded")
172
                        .HasColumnType("timestamp with time zone");
173

  
174
                    b.Property<int>("Length")
175
                        .HasColumnType("integer");
176

  
177
                    b.Property<string>("Name")
178
                        .HasColumnType("text");
179

  
180
                    b.Property<int>("RequiredAnnotations")
181
                        .HasColumnType("integer");
182

  
183
                    b.Property<Guid?>("UserAddedId")
184
                        .HasColumnType("uuid");
185

  
186
                    b.HasKey("Id");
187

  
188
                    b.HasIndex("ContentId");
189

  
190
                    b.HasIndex("UserAddedId");
191

  
192
                    b.ToTable("Documents");
193
                });
194

  
195
            modelBuilder.Entity("Core.Entities.DocumentContent", b =>
196
                {
197
                    b.Property<Guid>("Id")
198
                        .ValueGeneratedOnAdd()
199
                        .HasColumnType("uuid");
200

  
201
                    b.Property<string>("Content")
202
                        .IsRequired()
203
                        .HasColumnType("text");
204

  
205
                    b.HasKey("Id");
206

  
207
                    b.ToTable("DocumentContents");
208
                });
209

  
210
            modelBuilder.Entity("Core.Entities.SubTag", b =>
211
                {
212
                    b.Property<Guid>("Id")
213
                        .ValueGeneratedOnAdd()
214
                        .HasColumnType("uuid");
215

  
216
                    b.Property<string>("Description")
217
                        .IsRequired()
218
                        .HasColumnType("text");
219

  
220
                    b.Property<string>("Name")
221
                        .IsRequired()
222
                        .HasColumnType("text");
223

  
224
                    b.Property<Guid>("TagId")
225
                        .HasColumnType("uuid");
226

  
227
                    b.HasKey("Id");
228

  
229
                    b.HasIndex("TagId");
230

  
231
                    b.ToTable("SubTags");
232
                });
233

  
234
            modelBuilder.Entity("Core.Entities.Tag", b =>
235
                {
236
                    b.Property<Guid>("Id")
237
                        .ValueGeneratedOnAdd()
238
                        .HasColumnType("uuid");
239

  
240
                    b.Property<Guid>("CategoryId")
241
                        .HasColumnType("uuid");
242

  
243
                    b.Property<string>("Color")
244
                        .IsRequired()
245
                        .HasColumnType("text");
246

  
247
                    b.Property<string>("Description")
248
                        .IsRequired()
249
                        .HasColumnType("text");
250

  
251
                    b.Property<string>("Name")
252
                        .IsRequired()
253
                        .HasColumnType("text");
254

  
255
                    b.HasKey("Id");
256

  
257
                    b.HasIndex("CategoryId");
258

  
259
                    b.ToTable("Tags");
260
                });
261

  
262
            modelBuilder.Entity("Core.Entities.TagCategory", b =>
263
                {
264
                    b.Property<Guid>("Id")
265
                        .ValueGeneratedOnAdd()
266
                        .HasColumnType("uuid");
267

  
268
                    b.Property<string>("Color")
269
                        .HasColumnType("text");
270

  
271
                    b.Property<string>("Description")
272
                        .HasColumnType("text");
273

  
274
                    b.Property<string>("Name")
275
                        .HasColumnType("text");
276

  
277
                    b.HasKey("Id");
278

  
279
                    b.ToTable("TagCategories");
280
                });
281

  
282
            modelBuilder.Entity("Core.Entities.User", b =>
283
                {
284
                    b.Property<Guid>("Id")
285
                        .ValueGeneratedOnAdd()
286
                        .HasColumnType("uuid");
287

  
288
                    b.Property<string>("Name")
289
                        .HasColumnType("text");
290

  
291
                    b.Property<string>("Password")
292
                        .HasColumnType("text");
293

  
294
                    b.Property<int>("Role")
295
                        .HasColumnType("integer");
296

  
297
                    b.Property<string>("Surname")
298
                        .HasColumnType("text");
299

  
300
                    b.Property<string>("Username")
301
                        .HasColumnType("text");
302

  
303
                    b.HasKey("Id");
304

  
305
                    b.ToTable("Users");
306
                });
307

  
308
            modelBuilder.Entity("AnnotationClass", b =>
309
                {
310
                    b.HasOne("Core.Entities.Annotation", null)
311
                        .WithMany()
312
                        .HasForeignKey("AnnotationsId")
313
                        .OnDelete(DeleteBehavior.Cascade)
314
                        .IsRequired();
315

  
316
                    b.HasOne("Core.Entities.Class", null)
317
                        .WithMany()
318
                        .HasForeignKey("ClassesId")
319
                        .OnDelete(DeleteBehavior.Cascade)
320
                        .IsRequired();
321
                });
322

  
323
            modelBuilder.Entity("Core.Entities.Annotation", b =>
324
                {
325
                    b.HasOne("Core.Entities.Document", "Document")
326
                        .WithMany()
327
                        .HasForeignKey("DocumentId")
328
                        .OnDelete(DeleteBehavior.Cascade)
329
                        .IsRequired();
330

  
331
                    b.HasOne("Core.Entities.User", "UserAssigned")
332
                        .WithMany()
333
                        .HasForeignKey("UserAssignedId")
334
                        .OnDelete(DeleteBehavior.Cascade)
335
                        .IsRequired();
336

  
337
                    b.HasOne("Core.Entities.User", "User")
338
                        .WithMany()
339
                        .HasForeignKey("UserId")
340
                        .OnDelete(DeleteBehavior.Cascade)
341
                        .IsRequired();
342

  
343
                    b.Navigation("Document");
344

  
345
                    b.Navigation("User");
346

  
347
                    b.Navigation("UserAssigned");
348
                });
349

  
350
            modelBuilder.Entity("Core.Entities.AnnotationTag", b =>
351
                {
352
                    b.HasOne("Core.Entities.Annotation", "Annotation")
353
                        .WithMany()
354
                        .HasForeignKey("AnnotationId")
355
                        .OnDelete(DeleteBehavior.Cascade)
356
                        .IsRequired();
357

  
358
                    b.HasOne("Core.Entities.SubTag", "SubTag")
359
                        .WithMany()
360
                        .HasForeignKey("SubTagId");
361

  
362
                    b.HasOne("Core.Entities.Tag", "Tag")
363
                        .WithMany()
364
                        .HasForeignKey("TagId")
365
                        .OnDelete(DeleteBehavior.Cascade)
366
                        .IsRequired();
367

  
368
                    b.Navigation("Annotation");
369

  
370
                    b.Navigation("SubTag");
371

  
372
                    b.Navigation("Tag");
373
                });
374

  
375
            modelBuilder.Entity("Core.Entities.Document", b =>
376
                {
377
                    b.HasOne("Core.Entities.DocumentContent", "Content")
378
                        .WithMany()
379
                        .HasForeignKey("ContentId");
380

  
381
                    b.HasOne("Core.Entities.User", "UserAdded")
382
                        .WithMany()
383
                        .HasForeignKey("UserAddedId");
384

  
385
                    b.Navigation("Content");
386

  
387
                    b.Navigation("UserAdded");
388
                });
389

  
390
            modelBuilder.Entity("Core.Entities.SubTag", b =>
391
                {
392
                    b.HasOne("Core.Entities.Tag", "Tag")
393
                        .WithMany()
394
                        .HasForeignKey("TagId")
395
                        .OnDelete(DeleteBehavior.Cascade)
396
                        .IsRequired();
397

  
398
                    b.Navigation("Tag");
399
                });
400

  
401
            modelBuilder.Entity("Core.Entities.Tag", b =>
402
                {
403
                    b.HasOne("Core.Entities.TagCategory", "Category")
404
                        .WithMany()
405
                        .HasForeignKey("CategoryId")
406
                        .OnDelete(DeleteBehavior.Cascade)
407
                        .IsRequired();
408

  
409
                    b.Navigation("Category");
410
                });
411
#pragma warning restore 612, 618
412
        }
413
    }
414
}
Backend/Backend/Migrations/20220427093145_V4.cs
1
using System;
2
using Microsoft.EntityFrameworkCore.Migrations;
3

  
4
#nullable disable
5

  
6
namespace RestAPI.Migrations
7
{
8
    public partial class V4 : Migration
9
    {
10
        protected override void Up(MigrationBuilder migrationBuilder)
11
        {
12
            migrationBuilder.CreateTable(
13
                name: "ConfigurationItems",
14
                columns: table => new
15
                {
16
                    Id = table.Column<Guid>(type: "uuid", nullable: false),
17
                    Value = table.Column<string>(type: "text", nullable: false),
18
                    Key = table.Column<string>(type: "text", nullable: false)
19
                },
20
                constraints: table =>
21
                {
22
                    table.PrimaryKey("PK_ConfigurationItems", x => x.Id);
23
                });
24
        }
25

  
26
        protected override void Down(MigrationBuilder migrationBuilder)
27
        {
28
            migrationBuilder.DropTable(
29
                name: "ConfigurationItems");
30
        }
31
    }
32
}
Backend/Backend/Migrations/DatabaseContextModelSnapshot.cs
138 138
                    b.ToTable("Classes");
139 139
                });
140 140

  
141
            modelBuilder.Entity("Core.Entities.ConfigurationItem", b =>
142
                {
143
                    b.Property<Guid>("Id")
144
                        .ValueGeneratedOnAdd()
145
                        .HasColumnType("uuid");
146

  
147
                    b.Property<string>("Key")
148
                        .IsRequired()
149
                        .HasColumnType("text");
150

  
151
                    b.Property<string>("Value")
152
                        .IsRequired()
153
                        .HasColumnType("text");
154

  
155
                    b.HasKey("Id");
156

  
157
                    b.ToTable("ConfigurationItems");
158
                });
159

  
141 160
            modelBuilder.Entity("Core.Entities.Document", b =>
142 161
                {
143 162
                    b.Property<Guid>("Id")

Také k dispozici: Unified diff