From 682b5a076c967f9f38dd32c0cffd4010548bd400 Mon Sep 17 00:00:00 2001 From: crupest Date: Sat, 19 Dec 2020 20:09:52 +0800 Subject: feat(database): Add migration, --- .../20201219120929_AddBookmarkTimeline.cs | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 BackEnd/Timeline/Migrations/20201219120929_AddBookmarkTimeline.cs (limited to 'BackEnd/Timeline/Migrations/20201219120929_AddBookmarkTimeline.cs') diff --git a/BackEnd/Timeline/Migrations/20201219120929_AddBookmarkTimeline.cs b/BackEnd/Timeline/Migrations/20201219120929_AddBookmarkTimeline.cs new file mode 100644 index 00000000..571d0419 --- /dev/null +++ b/BackEnd/Timeline/Migrations/20201219120929_AddBookmarkTimeline.cs @@ -0,0 +1,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(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + timeline = table.Column(type: "INTEGER", nullable: false), + user = table.Column(type: "INTEGER", nullable: false), + rank = table.Column(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"); + } + } +} -- cgit v1.2.3