aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline/Migrations/20201219120929_AddBookmarkTimeline.cs
blob: 571d0419f6894c5841d3999c8714446982534eb3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using Microsoft.EntityFrameworkCore.Migrations;

namespace Timeline.Migrations
{
    public partial class AddBookmarkTimeline : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "bookmark_timelines",
                columns: table => new
                {
                    id = table.Column<long>(type: "INTEGER", nullable: false)
                        .Annotation("Sqlite:Autoincrement", true),
                    timeline = table.Column<long>(type: "INTEGER", nullable: false),
                    user = table.Column<long>(type: "INTEGER", nullable: false),
                    rank = table.Column<long>(type: "INTEGER", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_bookmark_timelines", x => x.id);
                    table.ForeignKey(
                        name: "FK_bookmark_timelines_timelines_timeline",
                        column: x => x.timeline,
                        principalTable: "timelines",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_bookmark_timelines_users_user",
                        column: x => x.user,
                        principalTable: "users",
                        principalColumn: "id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateIndex(
                name: "IX_bookmark_timelines_timeline",
                table: "bookmark_timelines",
                column: "timeline");

            migrationBuilder.CreateIndex(
                name: "IX_bookmark_timelines_user",
                table: "bookmark_timelines",
                column: "user");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "bookmark_timelines");
        }
    }
}