diff options
| author | Jake Mannens <jake@asger.xyz> | 2023-08-09 16:07:56 +1000 |
|---|---|---|
| committer | Jake Mannens <jake@asger.xyz> | 2023-08-09 16:07:56 +1000 |
| commit | a86dfad7ef5a00a8f942130ba61e71c7cd50602d (patch) | |
| tree | c301263dc60956d230b71f8ef7ad77242876f969 /Migrations | |
| parent | e37895553ac379de78e9cf29b315afe4e6634c13 (diff) | |
Initial tag definition editing functionality
Diffstat (limited to 'Migrations')
| -rw-r--r-- | Migrations/20230809044429_Initial.Designer.cs | 206 | ||||
| -rw-r--r-- | Migrations/20230809044429_Initial.cs | 118 | ||||
| -rw-r--r-- | Migrations/HyperBooruDbContextModelSnapshot.cs | 203 |
3 files changed, 527 insertions, 0 deletions
diff --git a/Migrations/20230809044429_Initial.Designer.cs b/Migrations/20230809044429_Initial.Designer.cs new file mode 100644 index 0000000..78a0ca3 --- /dev/null +++ b/Migrations/20230809044429_Initial.Designer.cs @@ -0,0 +1,206 @@ +// <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(HyperBooruDbContext))] + [Migration("20230809044429_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.DbObject", b => + { + b.Property<int>("ObjectId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property<string>("Discriminator") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property<Guid>("Guid") + .HasColumnType("TEXT"); + + b.Property<int>("ObjectType") + .HasColumnType("INTEGER"); + + b.HasKey("ObjectId"); + + b.HasIndex("Guid"); + + b.ToTable("Objects"); + + b.HasDiscriminator<string>("Discriminator").HasValue("DbObject"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("HyperBooru.DbUploadedFile", 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"); + }); + + modelBuilder.Entity("HyperBooru.DbMedia", b => + { + b.HasBaseType("HyperBooru.DbObject"); + + 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.HasDiscriminator().HasValue("DbMedia"); + }); + + modelBuilder.Entity("HyperBooru.DbTag", b => + { + b.HasBaseType("HyperBooru.DbObject"); + + 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.HasDiscriminator().HasValue("DbTag"); + }); + + modelBuilder.Entity("HyperBooru.DbTagDefinition", b => + { + b.HasBaseType("HyperBooru.DbObject"); + + b.Property<int?>("DbTagDefinitionObjectId") + .HasColumnType("INTEGER"); + + b.Property<string>("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property<string>("Namespace") + .HasColumnType("TEXT"); + + b.Property<int>("Source") + .HasColumnType("INTEGER"); + + b.HasIndex("DbTagDefinitionObjectId"); + + b.HasDiscriminator().HasValue("DbTagDefinition"); + }); + + modelBuilder.Entity("HyperBooru.DbUploadedFile", b => + { + b.HasOne("HyperBooru.DbMedia", "Media") + .WithMany("UploadedFiles") + .HasForeignKey("MediaObjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Media"); + }); + + modelBuilder.Entity("HyperBooru.DbTag", b => + { + b.HasOne("HyperBooru.DbTagDefinition", "TagDefinition") + .WithMany() + .HasForeignKey("TagDefinitionObjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("HyperBooru.DbObject", "Target") + .WithMany("Tags") + .HasForeignKey("TargetObjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("TagDefinition"); + + b.Navigation("Target"); + }); + + modelBuilder.Entity("HyperBooru.DbTagDefinition", b => + { + b.HasOne("HyperBooru.DbTagDefinition", null) + .WithMany("ImplicitTags") + .HasForeignKey("DbTagDefinitionObjectId"); + }); + + modelBuilder.Entity("HyperBooru.DbObject", b => + { + b.Navigation("Tags"); + }); + + modelBuilder.Entity("HyperBooru.DbMedia", b => + { + b.Navigation("UploadedFiles"); + }); + + modelBuilder.Entity("HyperBooru.DbTagDefinition", b => + { + b.Navigation("ImplicitTags"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Migrations/20230809044429_Initial.cs b/Migrations/20230809044429_Initial.cs new file mode 100644 index 0000000..0126c13 --- /dev/null +++ b/Migrations/20230809044429_Initial.cs @@ -0,0 +1,118 @@ +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"); + } + } +} diff --git a/Migrations/HyperBooruDbContextModelSnapshot.cs b/Migrations/HyperBooruDbContextModelSnapshot.cs new file mode 100644 index 0000000..566b66c --- /dev/null +++ b/Migrations/HyperBooruDbContextModelSnapshot.cs @@ -0,0 +1,203 @@ +// <auto-generated /> +using System; +using HyperBooru; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace HyperBooru.Migrations +{ + [DbContext(typeof(HyperBooruDbContext))] + partial class HyperBooruDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(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.DbObject", b => + { + b.Property<int>("ObjectId") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property<string>("Discriminator") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property<Guid>("Guid") + .HasColumnType("TEXT"); + + b.Property<int>("ObjectType") + .HasColumnType("INTEGER"); + + b.HasKey("ObjectId"); + + b.HasIndex("Guid"); + + b.ToTable("Objects"); + + b.HasDiscriminator<string>("Discriminator").HasValue("DbObject"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("HyperBooru.DbUploadedFile", 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"); + }); + + modelBuilder.Entity("HyperBooru.DbMedia", b => + { + b.HasBaseType("HyperBooru.DbObject"); + + 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.HasDiscriminator().HasValue("DbMedia"); + }); + + modelBuilder.Entity("HyperBooru.DbTag", b => + { + b.HasBaseType("HyperBooru.DbObject"); + + 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.HasDiscriminator().HasValue("DbTag"); + }); + + modelBuilder.Entity("HyperBooru.DbTagDefinition", b => + { + b.HasBaseType("HyperBooru.DbObject"); + + b.Property<int?>("DbTagDefinitionObjectId") + .HasColumnType("INTEGER"); + + b.Property<string>("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property<string>("Namespace") + .HasColumnType("TEXT"); + + b.Property<int>("Source") + .HasColumnType("INTEGER"); + + b.HasIndex("DbTagDefinitionObjectId"); + + b.HasDiscriminator().HasValue("DbTagDefinition"); + }); + + modelBuilder.Entity("HyperBooru.DbUploadedFile", b => + { + b.HasOne("HyperBooru.DbMedia", "Media") + .WithMany("UploadedFiles") + .HasForeignKey("MediaObjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Media"); + }); + + modelBuilder.Entity("HyperBooru.DbTag", b => + { + b.HasOne("HyperBooru.DbTagDefinition", "TagDefinition") + .WithMany() + .HasForeignKey("TagDefinitionObjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("HyperBooru.DbObject", "Target") + .WithMany("Tags") + .HasForeignKey("TargetObjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("TagDefinition"); + + b.Navigation("Target"); + }); + + modelBuilder.Entity("HyperBooru.DbTagDefinition", b => + { + b.HasOne("HyperBooru.DbTagDefinition", null) + .WithMany("ImplicitTags") + .HasForeignKey("DbTagDefinitionObjectId"); + }); + + modelBuilder.Entity("HyperBooru.DbObject", b => + { + b.Navigation("Tags"); + }); + + modelBuilder.Entity("HyperBooru.DbMedia", b => + { + b.Navigation("UploadedFiles"); + }); + + modelBuilder.Entity("HyperBooru.DbTagDefinition", b => + { + b.Navigation("ImplicitTags"); + }); +#pragma warning restore 612, 618 + } + } +} |
