aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline/Migrations/20220417152839_AddRegisterCode.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-04-17 23:31:15 +0800
committercrupest <crupest@outlook.com>2022-04-17 23:31:15 +0800
commitad2829be08116cdb596990c1152e1dfc4f0ffe47 (patch)
treee7f2f5dd2fd72889148d323492de7ab9d5cfce8d /BackEnd/Timeline/Migrations/20220417152839_AddRegisterCode.cs
parent84cb99d087f62dca89fa682feae6738b3350fed4 (diff)
downloadtimeline-ad2829be08116cdb596990c1152e1dfc4f0ffe47.tar.gz
timeline-ad2829be08116cdb596990c1152e1dfc4f0ffe47.tar.bz2
timeline-ad2829be08116cdb596990c1152e1dfc4f0ffe47.zip
...
Diffstat (limited to 'BackEnd/Timeline/Migrations/20220417152839_AddRegisterCode.cs')
-rw-r--r--BackEnd/Timeline/Migrations/20220417152839_AddRegisterCode.cs84
1 files changed, 84 insertions, 0 deletions
diff --git a/BackEnd/Timeline/Migrations/20220417152839_AddRegisterCode.cs b/BackEnd/Timeline/Migrations/20220417152839_AddRegisterCode.cs
new file mode 100644
index 00000000..c76cb4d0
--- /dev/null
+++ b/BackEnd/Timeline/Migrations/20220417152839_AddRegisterCode.cs
@@ -0,0 +1,84 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace Timeline.Migrations
+{
+ public partial class AddRegisterCode : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "register_code",
+ columns: table => new
+ {
+ id = table.Column<long>(type: "INTEGER", nullable: false)
+ .Annotation("Sqlite:Autoincrement", true),
+ owner_id = table.Column<long>(type: "INTEGER", nullable: true),
+ code = table.Column<string>(type: "TEXT", nullable: false),
+ enabled = table.Column<bool>(type: "INTEGER", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_register_code", x => x.id);
+ table.ForeignKey(
+ name: "FK_register_code_users_owner_id",
+ column: x => x.owner_id,
+ principalTable: "users",
+ principalColumn: "id");
+ });
+
+ migrationBuilder.CreateTable(
+ name: "user_register_info",
+ columns: table => new
+ {
+ id = table.Column<long>(type: "INTEGER", nullable: false)
+ .Annotation("Sqlite:Autoincrement", true),
+ user_id = table.Column<long>(type: "INTEGER", nullable: false),
+ register_code = table.Column<string>(type: "TEXT", nullable: false),
+ introducer_id = table.Column<long>(type: "INTEGER", nullable: true),
+ register_time = table.Column<DateTime>(type: "TEXT", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_user_register_info", x => x.id);
+ table.ForeignKey(
+ name: "FK_user_register_info_users_introducer_id",
+ column: x => x.introducer_id,
+ principalTable: "users",
+ principalColumn: "id");
+ table.ForeignKey(
+ name: "FK_user_register_info_users_user_id",
+ column: x => x.user_id,
+ principalTable: "users",
+ principalColumn: "id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_register_code_owner_id",
+ table: "register_code",
+ column: "owner_id");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_user_register_info_introducer_id",
+ table: "user_register_info",
+ column: "introducer_id");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_user_register_info_user_id",
+ table: "user_register_info",
+ column: "user_id");
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "register_code");
+
+ migrationBuilder.DropTable(
+ name: "user_register_info");
+ }
+ }
+}