1
|
using Microsoft.EntityFrameworkCore.Migrations;
|
2
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
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.DropTable(
|
13
|
name: "AnnotationsClasses");
|
14
|
|
15
|
migrationBuilder.CreateTable(
|
16
|
name: "AnnotationClass",
|
17
|
columns: table => new
|
18
|
{
|
19
|
AnnotationsId = table.Column<int>(type: "integer", nullable: false),
|
20
|
ClassesId = table.Column<int>(type: "integer", nullable: false)
|
21
|
},
|
22
|
constraints: table =>
|
23
|
{
|
24
|
table.PrimaryKey("PK_AnnotationClass", x => new { x.AnnotationsId, x.ClassesId });
|
25
|
table.ForeignKey(
|
26
|
name: "FK_AnnotationClass_Annotations_AnnotationsId",
|
27
|
column: x => x.AnnotationsId,
|
28
|
principalTable: "Annotations",
|
29
|
principalColumn: "Id",
|
30
|
onDelete: ReferentialAction.Cascade);
|
31
|
table.ForeignKey(
|
32
|
name: "FK_AnnotationClass_Classes_ClassesId",
|
33
|
column: x => x.ClassesId,
|
34
|
principalTable: "Classes",
|
35
|
principalColumn: "Id",
|
36
|
onDelete: ReferentialAction.Cascade);
|
37
|
});
|
38
|
|
39
|
migrationBuilder.CreateIndex(
|
40
|
name: "IX_AnnotationClass_ClassesId",
|
41
|
table: "AnnotationClass",
|
42
|
column: "ClassesId");
|
43
|
}
|
44
|
|
45
|
protected override void Down(MigrationBuilder migrationBuilder)
|
46
|
{
|
47
|
migrationBuilder.DropTable(
|
48
|
name: "AnnotationClass");
|
49
|
|
50
|
migrationBuilder.CreateTable(
|
51
|
name: "AnnotationsClasses",
|
52
|
columns: table => new
|
53
|
{
|
54
|
Id = table.Column<int>(type: "integer", nullable: false)
|
55
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
56
|
AnnotationId = table.Column<int>(type: "integer", nullable: false),
|
57
|
ClassId = table.Column<int>(type: "integer", nullable: false)
|
58
|
},
|
59
|
constraints: table =>
|
60
|
{
|
61
|
table.PrimaryKey("PK_AnnotationsClasses", x => x.Id);
|
62
|
table.ForeignKey(
|
63
|
name: "FK_AnnotationsClasses_Annotations_AnnotationId",
|
64
|
column: x => x.AnnotationId,
|
65
|
principalTable: "Annotations",
|
66
|
principalColumn: "Id",
|
67
|
onDelete: ReferentialAction.Cascade);
|
68
|
table.ForeignKey(
|
69
|
name: "FK_AnnotationsClasses_Classes_ClassId",
|
70
|
column: x => x.ClassId,
|
71
|
principalTable: "Classes",
|
72
|
principalColumn: "Id",
|
73
|
onDelete: ReferentialAction.Cascade);
|
74
|
});
|
75
|
|
76
|
migrationBuilder.CreateIndex(
|
77
|
name: "IX_AnnotationsClasses_AnnotationId",
|
78
|
table: "AnnotationsClasses",
|
79
|
column: "AnnotationId");
|
80
|
|
81
|
migrationBuilder.CreateIndex(
|
82
|
name: "IX_AnnotationsClasses_ClassId",
|
83
|
table: "AnnotationsClasses",
|
84
|
column: "ClassId");
|
85
|
}
|
86
|
}
|
87
|
}
|