diff options
author | crupest <crupest@outlook.com> | 2021-02-12 22:16:04 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-02-12 22:16:04 +0800 |
commit | 118fb9b15ba62837a0befaad0aaea156b0488aea (patch) | |
tree | 472c343903ebf3c418435bb260ab5b0f147b64cd /BackEnd/Timeline/Migrations/20210212141443_PostData.cs | |
parent | 83de31a999132b052f1ccec75eb664c9e4a18e87 (diff) | |
download | timeline-118fb9b15ba62837a0befaad0aaea156b0488aea.tar.gz timeline-118fb9b15ba62837a0befaad0aaea156b0488aea.tar.bz2 timeline-118fb9b15ba62837a0befaad0aaea156b0488aea.zip |
feat: Add post data database schema migration.
Diffstat (limited to 'BackEnd/Timeline/Migrations/20210212141443_PostData.cs')
-rw-r--r-- | BackEnd/Timeline/Migrations/20210212141443_PostData.cs | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/BackEnd/Timeline/Migrations/20210212141443_PostData.cs b/BackEnd/Timeline/Migrations/20210212141443_PostData.cs new file mode 100644 index 00000000..5a0c6179 --- /dev/null +++ b/BackEnd/Timeline/Migrations/20210212141443_PostData.cs @@ -0,0 +1,90 @@ +using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+namespace Timeline.Migrations
+{
+ public partial class PostData : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AlterColumn<string>(
+ name: "content_type",
+ table: "timeline_posts",
+ type: "TEXT",
+ nullable: true,
+ oldClrType: typeof(string),
+ oldType: "TEXT");
+
+ migrationBuilder.AddColumn<bool>(
+ name: "deleted",
+ table: "timeline_posts",
+ type: "INTEGER",
+ nullable: false,
+ defaultValue: false);
+
+ migrationBuilder.CreateTable(
+ name: "migrations",
+ columns: table => new
+ {
+ id = table.Column<long>(type: "INTEGER", nullable: false)
+ .Annotation("Sqlite:Autoincrement", true),
+ name = table.Column<string>(type: "TEXT", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_migrations", x => x.id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "timeline_post_data",
+ columns: table => new
+ {
+ id = table.Column<long>(type: "INTEGER", nullable: false)
+ .Annotation("Sqlite:Autoincrement", true),
+ post = table.Column<long>(type: "INTEGER", nullable: false),
+ index = table.Column<long>(type: "INTEGER", nullable: false),
+ kind = table.Column<string>(type: "TEXT", nullable: false),
+ data_tag = table.Column<string>(type: "TEXT", nullable: false),
+ last_updated = table.Column<DateTime>(type: "TEXT", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_timeline_post_data", x => x.id);
+ table.ForeignKey(
+ name: "FK_timeline_post_data_timeline_posts_post",
+ column: x => x.post,
+ principalTable: "timeline_posts",
+ principalColumn: "id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_timeline_post_data_post",
+ table: "timeline_post_data",
+ column: "post");
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "migrations");
+
+ migrationBuilder.DropTable(
+ name: "timeline_post_data");
+
+ migrationBuilder.DropColumn(
+ name: "deleted",
+ table: "timeline_posts");
+
+ migrationBuilder.AlterColumn<string>(
+ name: "content_type",
+ table: "timeline_posts",
+ type: "TEXT",
+ nullable: false,
+ defaultValue: "",
+ oldClrType: typeof(string),
+ oldType: "TEXT",
+ oldNullable: true);
+ }
+ }
+}
|