summaryrefslogtreecommitdiff
path: root/Migrations/20230809044429_Initial.cs
diff options
context:
space:
mode:
authorJake Mannens <jake@asger.xyz>2023-08-11 14:41:40 +1000
committerJake Mannens <jake@asger.xyz>2023-08-11 14:41:40 +1000
commit0d758c6cd118641e86e6a7ddd7285be916cdb2d8 (patch)
tree846038e97117c48106db059592a7b41749cbcd11 /Migrations/20230809044429_Initial.cs
parentbc8385a9e63253a3190b08467cbf31d0256053e8 (diff)
Updated database schema to use separate tables
Diffstat (limited to 'Migrations/20230809044429_Initial.cs')
-rw-r--r--Migrations/20230809044429_Initial.cs118
1 files changed, 0 insertions, 118 deletions
diff --git a/Migrations/20230809044429_Initial.cs b/Migrations/20230809044429_Initial.cs
deleted file mode 100644
index 0126c13..0000000
--- a/Migrations/20230809044429_Initial.cs
+++ /dev/null
@@ -1,118 +0,0 @@
-using System;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-namespace HyperBooru.Migrations
-{
- /// <inheritdoc />
- public partial class Initial : Migration
- {
- /// <inheritdoc />
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "Objects",
- columns: table => new
- {
- ObjectId = table.Column<int>(type: "INTEGER", nullable: false)
- .Annotation("Sqlite:Autoincrement", true),
- Guid = table.Column<Guid>(type: "TEXT", nullable: false),
- ObjectType = table.Column<int>(type: "INTEGER", nullable: false),
- Discriminator = table.Column<string>(type: "TEXT", nullable: false),
- Checksum = table.Column<string>(type: "TEXT", nullable: true),
- MimeType = table.Column<string>(type: "TEXT", nullable: true),
- ShortDescription = table.Column<string>(type: "TEXT", nullable: true),
- LongDescription = table.Column<string>(type: "TEXT", nullable: true),
- TagDefinitionObjectId = table.Column<int>(type: "INTEGER", nullable: true),
- CreateTime = table.Column<DateTime>(type: "TEXT", nullable: true),
- TargetObjectId = table.Column<int>(type: "INTEGER", nullable: true),
- Source = table.Column<int>(type: "INTEGER", nullable: true),
- Namespace = table.Column<string>(type: "TEXT", nullable: true),
- Name = table.Column<string>(type: "TEXT", nullable: true),
- DbTagDefinitionObjectId = table.Column<int>(type: "INTEGER", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Objects", x => x.ObjectId);
- table.ForeignKey(
- name: "FK_Objects_Objects_DbTagDefinitionObjectId",
- column: x => x.DbTagDefinitionObjectId,
- principalTable: "Objects",
- principalColumn: "ObjectId");
- table.ForeignKey(
- name: "FK_Objects_Objects_TagDefinitionObjectId",
- column: x => x.TagDefinitionObjectId,
- principalTable: "Objects",
- principalColumn: "ObjectId",
- onDelete: ReferentialAction.Cascade);
- table.ForeignKey(
- name: "FK_Objects_Objects_TargetObjectId",
- column: x => x.TargetObjectId,
- principalTable: "Objects",
- principalColumn: "ObjectId",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateTable(
- name: "UploadedFiles",
- columns: table => new
- {
- UploadedFileId = table.Column<int>(type: "INTEGER", nullable: false)
- .Annotation("Sqlite:Autoincrement", true),
- OriginalChecksum = table.Column<string>(type: "TEXT", nullable: false),
- Filename = table.Column<string>(type: "TEXT", nullable: true),
- UploadTime = table.Column<DateTime>(type: "TEXT", nullable: false),
- LastAccessTime = table.Column<DateTime>(type: "TEXT", nullable: true),
- LastWriteTime = table.Column<DateTime>(type: "TEXT", nullable: true),
- CreateTime = table.Column<DateTime>(type: "TEXT", nullable: true),
- MediaObjectId = table.Column<int>(type: "INTEGER", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_UploadedFiles", x => x.UploadedFileId);
- table.ForeignKey(
- name: "FK_UploadedFiles_Objects_MediaObjectId",
- column: x => x.MediaObjectId,
- principalTable: "Objects",
- principalColumn: "ObjectId",
- onDelete: ReferentialAction.Cascade);
- });
-
- migrationBuilder.CreateIndex(
- name: "IX_Objects_DbTagDefinitionObjectId",
- table: "Objects",
- column: "DbTagDefinitionObjectId");
-
- migrationBuilder.CreateIndex(
- name: "IX_Objects_Guid",
- table: "Objects",
- column: "Guid");
-
- migrationBuilder.CreateIndex(
- name: "IX_Objects_TagDefinitionObjectId",
- table: "Objects",
- column: "TagDefinitionObjectId");
-
- migrationBuilder.CreateIndex(
- name: "IX_Objects_TargetObjectId",
- table: "Objects",
- column: "TargetObjectId");
-
- migrationBuilder.CreateIndex(
- name: "IX_UploadedFiles_MediaObjectId",
- table: "UploadedFiles",
- column: "MediaObjectId");
- }
-
- /// <inheritdoc />
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "UploadedFiles");
-
- migrationBuilder.DropTable(
- name: "Objects");
- }
- }
-}