diff options
| author | Jake Mannens <jake@asger.xyz> | 2023-08-17 13:54:01 +1000 |
|---|---|---|
| committer | Jake Mannens <jake@asger.xyz> | 2023-08-17 13:54:01 +1000 |
| commit | a57b6ea2e174cedb04a422a05a180f377ed4c448 (patch) | |
| tree | cd454fa16c7d37a484268c722b9b57527dad2b4b /Migrations | |
| parent | 727dcaacc6df8813a9296ac858dd51d11f3737b8 (diff) | |
Fixed implicit tagging completely and switched DB to PostgreSQL
Diffstat (limited to 'Migrations')
| -rw-r--r-- | Migrations/20230814013743_Initial.Designer.cs | 234 | ||||
| -rw-r--r-- | Migrations/20230816233054_ImplicitTags.cs | 123 | ||||
| -rw-r--r-- | Migrations/20230817010522_Initial.Designer.cs (renamed from Migrations/20230816233054_ImplicitTags.Designer.cs) | 62 | ||||
| -rw-r--r-- | Migrations/20230817010522_Initial.cs (renamed from Migrations/20230814013743_Initial.cs) | 101 | ||||
| -rw-r--r-- | Migrations/HBContextModelSnapshot.cs | 58 |
5 files changed, 128 insertions, 450 deletions
diff --git a/Migrations/20230814013743_Initial.Designer.cs b/Migrations/20230814013743_Initial.Designer.cs deleted file mode 100644 index c221c85..0000000 --- a/Migrations/20230814013743_Initial.Designer.cs +++ /dev/null @@ -1,234 +0,0 @@ -// <auto-generated /> -using System; -using HyperBooru; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace HyperBooru.Migrations -{ - [DbContext(typeof(HBContext))] - [Migration("20230814013743_Initial")] - partial class Initial - { - /// <inheritdoc /> - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.10") - .HasAnnotation("Proxies:ChangeTracking", false) - .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); - - modelBuilder.Entity("HyperBooru.HBObject", b => - { - b.Property<int>("ObjectId") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<Guid>("Guid") - .HasColumnType("TEXT"); - - b.HasKey("ObjectId"); - - b.HasIndex("Guid"); - - b.ToTable("Objects", (string)null); - - b.UseTptMappingStrategy(); - }); - - modelBuilder.Entity("HyperBooru.UploadedFile", b => - { - b.Property<int>("UploadedFileId") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property<DateTime?>("CreateTime") - .HasColumnType("TEXT"); - - b.Property<string>("Filename") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("LastAccessTime") - .HasColumnType("TEXT"); - - b.Property<DateTime?>("LastWriteTime") - .HasColumnType("TEXT"); - - b.Property<int>("MediaObjectId") - .HasColumnType("INTEGER"); - - b.Property<string>("OriginalChecksum") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<DateTime>("UploadTime") - .HasColumnType("TEXT"); - - b.HasKey("UploadedFileId"); - - b.HasIndex("MediaObjectId"); - - b.ToTable("UploadedFiles", (string)null); - }); - - modelBuilder.Entity("HyperBooru.Media", b => - { - b.HasBaseType("HyperBooru.HBObject"); - - b.Property<string>("Checksum") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("LongDescription") - .HasColumnType("TEXT"); - - b.Property<string>("MimeType") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("ShortDescription") - .HasColumnType("TEXT"); - - b.ToTable("Media", (string)null); - }); - - modelBuilder.Entity("HyperBooru.Tag", b => - { - b.HasBaseType("HyperBooru.HBObject"); - - b.Property<DateTime>("CreateTime") - .HasColumnType("TEXT"); - - b.Property<int>("TagDefinitionObjectId") - .HasColumnType("INTEGER"); - - b.Property<int>("TargetObjectId") - .HasColumnType("INTEGER"); - - b.HasIndex("TagDefinitionObjectId"); - - b.HasIndex("TargetObjectId"); - - b.ToTable("Tags", (string)null); - }); - - modelBuilder.Entity("HyperBooru.TagDefinition", b => - { - b.HasBaseType("HyperBooru.HBObject"); - - b.Property<string>("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<string>("Namespace") - .HasColumnType("TEXT"); - - b.Property<int>("Source") - .HasColumnType("INTEGER"); - - b.Property<int?>("TagDefinitionObjectId") - .HasColumnType("INTEGER"); - - b.HasIndex("TagDefinitionObjectId"); - - b.ToTable("TagDefinitions", (string)null); - - b.HasData( - new - { - ObjectId = -1, - Guid = new Guid("cbd871cb-8790-4519-9f74-90d1e13a48a0"), - Name = "nsfw", - Source = 0 - }, - new - { - ObjectId = -2, - Guid = new Guid("716ac11f-135a-433c-84a7-7bdfddbec004"), - Name = "ingest", - Source = 0 - }); - }); - - modelBuilder.Entity("HyperBooru.UploadedFile", b => - { - b.HasOne("HyperBooru.Media", "Media") - .WithMany("UploadedFiles") - .HasForeignKey("MediaObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Media"); - }); - - modelBuilder.Entity("HyperBooru.Media", b => - { - b.HasOne("HyperBooru.HBObject", null) - .WithOne() - .HasForeignKey("HyperBooru.Media", "ObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("HyperBooru.Tag", b => - { - b.HasOne("HyperBooru.HBObject", null) - .WithOne() - .HasForeignKey("HyperBooru.Tag", "ObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("HyperBooru.TagDefinition", "TagDefinition") - .WithMany() - .HasForeignKey("TagDefinitionObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("HyperBooru.HBObject", "Target") - .WithMany("Tags") - .HasForeignKey("TargetObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("TagDefinition"); - - b.Navigation("Target"); - }); - - modelBuilder.Entity("HyperBooru.TagDefinition", b => - { - b.HasOne("HyperBooru.HBObject", null) - .WithOne() - .HasForeignKey("HyperBooru.TagDefinition", "ObjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("HyperBooru.TagDefinition", null) - .WithMany("ImplicitTags") - .HasForeignKey("TagDefinitionObjectId"); - }); - - modelBuilder.Entity("HyperBooru.HBObject", b => - { - b.Navigation("Tags"); - }); - - modelBuilder.Entity("HyperBooru.Media", b => - { - b.Navigation("UploadedFiles"); - }); - - modelBuilder.Entity("HyperBooru.TagDefinition", b => - { - b.Navigation("ImplicitTags"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Migrations/20230816233054_ImplicitTags.cs b/Migrations/20230816233054_ImplicitTags.cs deleted file mode 100644 index 26078d6..0000000 --- a/Migrations/20230816233054_ImplicitTags.cs +++ /dev/null @@ -1,123 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace HyperBooru.Migrations -{ - /// <inheritdoc /> - public partial class ImplicitTags : Migration - { - /// <inheritdoc /> - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_TagDefinitions_TagDefinitions_TagDefinitionObjectId", - table: "TagDefinitions"); - - migrationBuilder.DropIndex( - name: "IX_TagDefinitions_TagDefinitionObjectId", - table: "TagDefinitions"); - - migrationBuilder.DropColumn( - name: "TagDefinitionObjectId", - table: "TagDefinitions"); - - migrationBuilder.CreateTable( - name: "TagDefinitionTagDefinition", - columns: table => new - { - ImplicitTagsObjectId = table.Column<int>(type: "INTEGER", nullable: false), - TagDefinitionObjectId = table.Column<int>(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_TagDefinitionTagDefinition", x => new { x.ImplicitTagsObjectId, x.TagDefinitionObjectId }); - table.ForeignKey( - name: "FK_TagDefinitionTagDefinition_TagDefinitions_ImplicitTagsObjectId", - column: x => x.ImplicitTagsObjectId, - principalTable: "TagDefinitions", - principalColumn: "ObjectId", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_TagDefinitionTagDefinition_TagDefinitions_TagDefinitionObjectId", - column: x => x.TagDefinitionObjectId, - principalTable: "TagDefinitions", - principalColumn: "ObjectId", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.UpdateData( - table: "Objects", - keyColumn: "ObjectId", - keyValue: -2, - column: "Guid", - value: new Guid("8b9cd13c-422a-4958-b97e-b858ac9301db")); - - migrationBuilder.UpdateData( - table: "Objects", - keyColumn: "ObjectId", - keyValue: -1, - column: "Guid", - value: new Guid("13399c38-34b8-44a1-ac42-536bd32de96a")); - - migrationBuilder.CreateIndex( - name: "IX_TagDefinitionTagDefinition_TagDefinitionObjectId", - table: "TagDefinitionTagDefinition", - column: "TagDefinitionObjectId"); - } - - /// <inheritdoc /> - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "TagDefinitionTagDefinition"); - - migrationBuilder.AddColumn<int>( - name: "TagDefinitionObjectId", - table: "TagDefinitions", - type: "INTEGER", - nullable: true); - - migrationBuilder.UpdateData( - table: "Objects", - keyColumn: "ObjectId", - keyValue: -2, - column: "Guid", - value: new Guid("716ac11f-135a-433c-84a7-7bdfddbec004")); - - migrationBuilder.UpdateData( - table: "Objects", - keyColumn: "ObjectId", - keyValue: -1, - column: "Guid", - value: new Guid("cbd871cb-8790-4519-9f74-90d1e13a48a0")); - - migrationBuilder.UpdateData( - table: "TagDefinitions", - keyColumn: "ObjectId", - keyValue: -2, - column: "TagDefinitionObjectId", - value: null); - - migrationBuilder.UpdateData( - table: "TagDefinitions", - keyColumn: "ObjectId", - keyValue: -1, - column: "TagDefinitionObjectId", - value: null); - - migrationBuilder.CreateIndex( - name: "IX_TagDefinitions_TagDefinitionObjectId", - table: "TagDefinitions", - column: "TagDefinitionObjectId"); - - migrationBuilder.AddForeignKey( - name: "FK_TagDefinitions_TagDefinitions_TagDefinitionObjectId", - table: "TagDefinitions", - column: "TagDefinitionObjectId", - principalTable: "TagDefinitions", - principalColumn: "ObjectId"); - } - } -} diff --git a/Migrations/20230816233054_ImplicitTags.Designer.cs b/Migrations/20230817010522_Initial.Designer.cs index 531b14c..1219beb 100644 --- a/Migrations/20230816233054_ImplicitTags.Designer.cs +++ b/Migrations/20230817010522_Initial.Designer.cs @@ -5,14 +5,15 @@ using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace HyperBooru.Migrations { [DbContext(typeof(HBContext))] - [Migration("20230816233054_ImplicitTags")] - partial class ImplicitTags + [Migration("20230817010522_Initial")] + partial class Initial { /// <inheritdoc /> protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -22,16 +23,21 @@ namespace HyperBooru.Migrations .HasAnnotation("ProductVersion", "7.0.10") .HasAnnotation("Proxies:ChangeTracking", false) .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); + .HasAnnotation("Proxies:LazyLoading", true) + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); modelBuilder.Entity("HyperBooru.HBObject", b => { b.Property<int>("ObjectId") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ObjectId")); b.Property<Guid>("Guid") - .HasColumnType("TEXT"); + .HasColumnType("uuid"); b.HasKey("ObjectId"); @@ -46,29 +52,31 @@ namespace HyperBooru.Migrations { b.Property<int>("UploadedFileId") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("UploadedFileId")); b.Property<DateTime?>("CreateTime") - .HasColumnType("TEXT"); + .HasColumnType("timestamp with time zone"); b.Property<string>("Filename") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property<DateTime?>("LastAccessTime") - .HasColumnType("TEXT"); + .HasColumnType("timestamp with time zone"); b.Property<DateTime?>("LastWriteTime") - .HasColumnType("TEXT"); + .HasColumnType("timestamp with time zone"); b.Property<int>("MediaObjectId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property<string>("OriginalChecksum") .IsRequired() - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property<DateTime>("UploadTime") - .HasColumnType("TEXT"); + .HasColumnType("timestamp with time zone"); b.HasKey("UploadedFileId"); @@ -80,10 +88,10 @@ namespace HyperBooru.Migrations modelBuilder.Entity("TagDefinitionTagDefinition", b => { b.Property<int>("ImplicitTagsObjectId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property<int>("TagDefinitionObjectId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.HasKey("ImplicitTagsObjectId", "TagDefinitionObjectId"); @@ -98,17 +106,17 @@ namespace HyperBooru.Migrations b.Property<string>("Checksum") .IsRequired() - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property<string>("LongDescription") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property<string>("MimeType") .IsRequired() - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property<string>("ShortDescription") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.ToTable("Media", (string)null); }); @@ -118,13 +126,13 @@ namespace HyperBooru.Migrations b.HasBaseType("HyperBooru.HBObject"); b.Property<DateTime>("CreateTime") - .HasColumnType("TEXT"); + .HasColumnType("timestamp with time zone"); b.Property<int>("TagDefinitionObjectId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property<int>("TargetObjectId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.HasIndex("TagDefinitionObjectId"); @@ -139,13 +147,13 @@ namespace HyperBooru.Migrations b.Property<string>("Name") .IsRequired() - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property<string>("Namespace") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property<int>("Source") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.ToTable("TagDefinitions", (string)null); @@ -153,14 +161,14 @@ namespace HyperBooru.Migrations new { ObjectId = -1, - Guid = new Guid("13399c38-34b8-44a1-ac42-536bd32de96a"), + Guid = new Guid("e906ff13-ee7d-4eb2-826b-1cf880590f6b"), Name = "nsfw", Source = 0 }, new { ObjectId = -2, - Guid = new Guid("8b9cd13c-422a-4958-b97e-b858ac9301db"), + Guid = new Guid("bab0a0f2-b126-429c-a80e-4f339a1f4bb2"), Name = "ingest", Source = 0 }); diff --git a/Migrations/20230814013743_Initial.cs b/Migrations/20230817010522_Initial.cs index 1390c18..c8c8221 100644 --- a/Migrations/20230814013743_Initial.cs +++ b/Migrations/20230817010522_Initial.cs @@ -1,5 +1,6 @@ using System; using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable @@ -17,9 +18,9 @@ namespace HyperBooru.Migrations 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) + ObjectId = table.Column<int>(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Guid = table.Column<Guid>(type: "uuid", nullable: false) }, constraints: table => { @@ -30,12 +31,11 @@ namespace HyperBooru.Migrations name: "Media", columns: table => new { - ObjectId = table.Column<int>(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Checksum = table.Column<string>(type: "TEXT", nullable: false), - MimeType = table.Column<string>(type: "TEXT", nullable: false), - ShortDescription = table.Column<string>(type: "TEXT", nullable: true), - LongDescription = table.Column<string>(type: "TEXT", nullable: true) + ObjectId = table.Column<int>(type: "integer", nullable: false), + Checksum = table.Column<string>(type: "text", nullable: false), + MimeType = table.Column<string>(type: "text", nullable: false), + ShortDescription = table.Column<string>(type: "text", nullable: true), + LongDescription = table.Column<string>(type: "text", nullable: true) }, constraints: table => { @@ -52,12 +52,10 @@ namespace HyperBooru.Migrations name: "TagDefinitions", columns: table => new { - ObjectId = table.Column<int>(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Source = table.Column<int>(type: "INTEGER", nullable: false), - Namespace = table.Column<string>(type: "TEXT", nullable: true), - Name = table.Column<string>(type: "TEXT", nullable: false), - TagDefinitionObjectId = table.Column<int>(type: "INTEGER", nullable: true) + ObjectId = table.Column<int>(type: "integer", nullable: false), + Source = table.Column<int>(type: "integer", nullable: false), + Namespace = table.Column<string>(type: "text", nullable: true), + Name = table.Column<string>(type: "text", nullable: false) }, constraints: table => { @@ -68,26 +66,21 @@ namespace HyperBooru.Migrations principalTable: "Objects", principalColumn: "ObjectId", onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_TagDefinitions_TagDefinitions_TagDefinitionObjectId", - column: x => x.TagDefinitionObjectId, - principalTable: "TagDefinitions", - principalColumn: "ObjectId"); }); 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) + UploadedFileId = table.Column<int>(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + OriginalChecksum = table.Column<string>(type: "text", nullable: false), + Filename = table.Column<string>(type: "text", nullable: true), + UploadTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false), + LastAccessTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: true), + LastWriteTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: true), + CreateTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: true), + MediaObjectId = table.Column<int>(type: "integer", nullable: false) }, constraints: table => { @@ -101,14 +94,37 @@ namespace HyperBooru.Migrations }); migrationBuilder.CreateTable( + name: "TagDefinitionTagDefinition", + columns: table => new + { + ImplicitTagsObjectId = table.Column<int>(type: "integer", nullable: false), + TagDefinitionObjectId = table.Column<int>(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TagDefinitionTagDefinition", x => new { x.ImplicitTagsObjectId, x.TagDefinitionObjectId }); + table.ForeignKey( + name: "FK_TagDefinitionTagDefinition_TagDefinitions_ImplicitTagsObjec~", + column: x => x.ImplicitTagsObjectId, + principalTable: "TagDefinitions", + principalColumn: "ObjectId", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_TagDefinitionTagDefinition_TagDefinitions_TagDefinitionObje~", + column: x => x.TagDefinitionObjectId, + principalTable: "TagDefinitions", + principalColumn: "ObjectId", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( name: "Tags", columns: table => new { - ObjectId = table.Column<int>(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - TagDefinitionObjectId = table.Column<int>(type: "INTEGER", nullable: false), - CreateTime = table.Column<DateTime>(type: "TEXT", nullable: false), - TargetObjectId = table.Column<int>(type: "INTEGER", nullable: false) + ObjectId = table.Column<int>(type: "integer", nullable: false), + TagDefinitionObjectId = table.Column<int>(type: "integer", nullable: false), + CreateTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false), + TargetObjectId = table.Column<int>(type: "integer", nullable: false) }, constraints: table => { @@ -138,17 +154,17 @@ namespace HyperBooru.Migrations columns: new[] { "ObjectId", "Guid" }, values: new object[,] { - { -2, new Guid("716ac11f-135a-433c-84a7-7bdfddbec004") }, - { -1, new Guid("cbd871cb-8790-4519-9f74-90d1e13a48a0") } + { -2, new Guid("bab0a0f2-b126-429c-a80e-4f339a1f4bb2") }, + { -1, new Guid("e906ff13-ee7d-4eb2-826b-1cf880590f6b") } }); migrationBuilder.InsertData( table: "TagDefinitions", - columns: new[] { "ObjectId", "Name", "Namespace", "Source", "TagDefinitionObjectId" }, + columns: new[] { "ObjectId", "Name", "Namespace", "Source" }, values: new object[,] { - { -2, "ingest", null, 0, null }, - { -1, "nsfw", null, 0, null } + { -2, "ingest", null, 0 }, + { -1, "nsfw", null, 0 } }); migrationBuilder.CreateIndex( @@ -157,8 +173,8 @@ namespace HyperBooru.Migrations column: "Guid"); migrationBuilder.CreateIndex( - name: "IX_TagDefinitions_TagDefinitionObjectId", - table: "TagDefinitions", + name: "IX_TagDefinitionTagDefinition_TagDefinitionObjectId", + table: "TagDefinitionTagDefinition", column: "TagDefinitionObjectId"); migrationBuilder.CreateIndex( @@ -181,6 +197,9 @@ namespace HyperBooru.Migrations protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( + name: "TagDefinitionTagDefinition"); + + migrationBuilder.DropTable( name: "Tags"); migrationBuilder.DropTable( diff --git a/Migrations/HBContextModelSnapshot.cs b/Migrations/HBContextModelSnapshot.cs index 06712a6..aac8471 100644 --- a/Migrations/HBContextModelSnapshot.cs +++ b/Migrations/HBContextModelSnapshot.cs @@ -4,6 +4,7 @@ using HyperBooru; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable @@ -19,16 +20,21 @@ namespace HyperBooru.Migrations .HasAnnotation("ProductVersion", "7.0.10") .HasAnnotation("Proxies:ChangeTracking", false) .HasAnnotation("Proxies:CheckEquality", false) - .HasAnnotation("Proxies:LazyLoading", true); + .HasAnnotation("Proxies:LazyLoading", true) + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); modelBuilder.Entity("HyperBooru.HBObject", b => { b.Property<int>("ObjectId") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ObjectId")); b.Property<Guid>("Guid") - .HasColumnType("TEXT"); + .HasColumnType("uuid"); b.HasKey("ObjectId"); @@ -43,29 +49,31 @@ namespace HyperBooru.Migrations { b.Property<int>("UploadedFileId") .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("UploadedFileId")); b.Property<DateTime?>("CreateTime") - .HasColumnType("TEXT"); + .HasColumnType("timestamp with time zone"); b.Property<string>("Filename") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property<DateTime?>("LastAccessTime") - .HasColumnType("TEXT"); + .HasColumnType("timestamp with time zone"); b.Property<DateTime?>("LastWriteTime") - .HasColumnType("TEXT"); + .HasColumnType("timestamp with time zone"); b.Property<int>("MediaObjectId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property<string>("OriginalChecksum") .IsRequired() - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property<DateTime>("UploadTime") - .HasColumnType("TEXT"); + .HasColumnType("timestamp with time zone"); b.HasKey("UploadedFileId"); @@ -77,10 +85,10 @@ namespace HyperBooru.Migrations modelBuilder.Entity("TagDefinitionTagDefinition", b => { b.Property<int>("ImplicitTagsObjectId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property<int>("TagDefinitionObjectId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.HasKey("ImplicitTagsObjectId", "TagDefinitionObjectId"); @@ -95,17 +103,17 @@ namespace HyperBooru.Migrations b.Property<string>("Checksum") .IsRequired() - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property<string>("LongDescription") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property<string>("MimeType") .IsRequired() - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property<string>("ShortDescription") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.ToTable("Media", (string)null); }); @@ -115,13 +123,13 @@ namespace HyperBooru.Migrations b.HasBaseType("HyperBooru.HBObject"); b.Property<DateTime>("CreateTime") - .HasColumnType("TEXT"); + .HasColumnType("timestamp with time zone"); b.Property<int>("TagDefinitionObjectId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.Property<int>("TargetObjectId") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.HasIndex("TagDefinitionObjectId"); @@ -136,13 +144,13 @@ namespace HyperBooru.Migrations b.Property<string>("Name") .IsRequired() - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property<string>("Namespace") - .HasColumnType("TEXT"); + .HasColumnType("text"); b.Property<int>("Source") - .HasColumnType("INTEGER"); + .HasColumnType("integer"); b.ToTable("TagDefinitions", (string)null); @@ -150,14 +158,14 @@ namespace HyperBooru.Migrations new { ObjectId = -1, - Guid = new Guid("13399c38-34b8-44a1-ac42-536bd32de96a"), + Guid = new Guid("e906ff13-ee7d-4eb2-826b-1cf880590f6b"), Name = "nsfw", Source = 0 }, new { ObjectId = -2, - Guid = new Guid("8b9cd13c-422a-4958-b97e-b858ac9301db"), + Guid = new Guid("bab0a0f2-b126-429c-a80e-4f339a1f4bb2"), Name = "ingest", Source = 0 }); |
