From 63bbf80cedf4404257ab28918fd4c9842296a604 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Farkas?= Date: Thu, 26 Dec 2024 14:26:39 +0100 Subject: [PATCH] chore: recreate migrations to cleanup --- .../20240416121538_Initial.Designer.cs | 135 ------------- ...082514_RenameCategoriesPuzzles.Designer.cs | 135 ------------- .../20241226082514_RenameCategoriesPuzzles.cs | 187 ------------------ ...26124356_RenameTablesCorrectly.Designer.cs | 136 ------------- .../20241226124356_RenameTablesCorrectly.cs | 134 ------------- ...6124529_RenameCollectionsTable.Designer.cs | 136 ------------- .../20241226124529_RenameCollectionsTable.cs | 78 -------- ...20241226131510_RenameCategoriesPuzzles2.cs | 79 -------- ...0241226132528_InitialRecreate.Designer.cs} | 4 +- ...l.cs => 20241226132528_InitialRecreate.cs} | 52 ++--- 10 files changed, 28 insertions(+), 1048 deletions(-) delete mode 100644 Database/Migrations/20240416121538_Initial.Designer.cs delete mode 100644 Database/Migrations/20241226082514_RenameCategoriesPuzzles.Designer.cs delete mode 100644 Database/Migrations/20241226082514_RenameCategoriesPuzzles.cs delete mode 100644 Database/Migrations/20241226124356_RenameTablesCorrectly.Designer.cs delete mode 100644 Database/Migrations/20241226124356_RenameTablesCorrectly.cs delete mode 100644 Database/Migrations/20241226124529_RenameCollectionsTable.Designer.cs delete mode 100644 Database/Migrations/20241226124529_RenameCollectionsTable.cs delete mode 100644 Database/Migrations/20241226131510_RenameCategoriesPuzzles2.cs rename Database/Migrations/{20241226131510_RenameCategoriesPuzzles2.Designer.cs => 20241226132528_InitialRecreate.Designer.cs} (97%) rename Database/Migrations/{20240416121538_Initial.cs => 20241226132528_InitialRecreate.cs} (63%) diff --git a/Database/Migrations/20240416121538_Initial.Designer.cs b/Database/Migrations/20240416121538_Initial.Designer.cs deleted file mode 100644 index dbe4726..0000000 --- a/Database/Migrations/20240416121538_Initial.Designer.cs +++ /dev/null @@ -1,135 +0,0 @@ -// -using System; -using ConnectionsAPI.Database; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace ConnectionsAPI.Database.Migrations -{ - [DbContext(typeof(ConnectionsContext))] - [Migration("20240416121538_Initial")] - partial class Initial - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "8.0.4"); - - modelBuilder.Entity("ConnectionsAPI.Database.Entities.Puzzle", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ContentMD5") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("EditorName") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Index") - .HasColumnType("INTEGER"); - - b.Property("PrintDate") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("PrintDate") - .IsUnique(); - - b.ToTable("Puzzles"); - }); - - modelBuilder.Entity("ConnectionsAPI.Database.Entities.PuzzleCard", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Content") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Position") - .HasColumnType("INTEGER"); - - b.Property("PuzzleCategoryId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("PuzzleCategoryId"); - - b.ToTable("PuzzleCard"); - }); - - modelBuilder.Entity("ConnectionsAPI.Database.Entities.PuzzleCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Color") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("PuzzleId") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("PuzzleId"); - - b.ToTable("PuzzleCategory"); - }); - - modelBuilder.Entity("ConnectionsAPI.Database.Entities.PuzzleCard", b => - { - b.HasOne("ConnectionsAPI.Database.Entities.PuzzleCategory", "PuzzleCategory") - .WithMany("PuzzleCards") - .HasForeignKey("PuzzleCategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PuzzleCategory"); - }); - - modelBuilder.Entity("ConnectionsAPI.Database.Entities.PuzzleCategory", b => - { - b.HasOne("ConnectionsAPI.Database.Entities.Puzzle", "Puzzle") - .WithMany("Categories") - .HasForeignKey("PuzzleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Puzzle"); - }); - - modelBuilder.Entity("ConnectionsAPI.Database.Entities.Puzzle", b => - { - b.Navigation("Categories"); - }); - - modelBuilder.Entity("ConnectionsAPI.Database.Entities.PuzzleCategory", b => - { - b.Navigation("PuzzleCards"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Database/Migrations/20241226082514_RenameCategoriesPuzzles.Designer.cs b/Database/Migrations/20241226082514_RenameCategoriesPuzzles.Designer.cs deleted file mode 100644 index 2835665..0000000 --- a/Database/Migrations/20241226082514_RenameCategoriesPuzzles.Designer.cs +++ /dev/null @@ -1,135 +0,0 @@ -// -using System; -using ConnectionsAPI.Database; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace ConnectionsAPI.Database.Migrations -{ - [DbContext(typeof(ConnectionsContext))] - [Migration("20241226082514_RenameCategoriesPuzzles")] - partial class RenameCategoriesPuzzles - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "8.0.4"); - - modelBuilder.Entity("ConnectionsAPI.Database.Entities.CategoriesCard", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CategoriesCategoryId") - .HasColumnType("INTEGER"); - - b.Property("Content") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Position") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("CategoriesCategoryId"); - - b.ToTable("CategoriesCard"); - }); - - modelBuilder.Entity("ConnectionsAPI.Database.Entities.CategoriesCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CategoriesPuzzleId") - .HasColumnType("INTEGER"); - - b.Property("Color") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("CategoriesPuzzleId"); - - b.ToTable("CategoriesCategory"); - }); - - modelBuilder.Entity("ConnectionsAPI.Database.Entities.CategoriesPuzzle", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ContentMD5") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("EditorName") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Index") - .HasColumnType("INTEGER"); - - b.Property("PrintDate") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("PrintDate") - .IsUnique(); - - b.ToTable("CategoriesPuzzles"); - }); - - modelBuilder.Entity("ConnectionsAPI.Database.Entities.CategoriesCard", b => - { - b.HasOne("ConnectionsAPI.Database.Entities.CategoriesCategory", "Category") - .WithMany("CategoriesPuzzleCards") - .HasForeignKey("CategoriesCategoryId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ConnectionsAPI.Database.Entities.CategoriesCategory", b => - { - b.HasOne("ConnectionsAPI.Database.Entities.CategoriesPuzzle", "CategoriesPuzzle") - .WithMany("Categories") - .HasForeignKey("CategoriesPuzzleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CategoriesPuzzle"); - }); - - modelBuilder.Entity("ConnectionsAPI.Database.Entities.CategoriesCategory", b => - { - b.Navigation("CategoriesPuzzleCards"); - }); - - modelBuilder.Entity("ConnectionsAPI.Database.Entities.CategoriesPuzzle", b => - { - b.Navigation("Categories"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Database/Migrations/20241226082514_RenameCategoriesPuzzles.cs b/Database/Migrations/20241226082514_RenameCategoriesPuzzles.cs deleted file mode 100644 index d7785b3..0000000 --- a/Database/Migrations/20241226082514_RenameCategoriesPuzzles.cs +++ /dev/null @@ -1,187 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ConnectionsAPI.Database.Migrations -{ - /// - public partial class RenameCategoriesPuzzles : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "PuzzleCard"); - - migrationBuilder.DropTable( - name: "PuzzleCategory"); - - migrationBuilder.DropTable( - name: "Puzzles"); - - migrationBuilder.CreateTable( - name: "CategoriesPuzzles", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - CreatedDate = table.Column(type: "TEXT", nullable: false), - PrintDate = table.Column(type: "TEXT", nullable: false), - EditorName = table.Column(type: "TEXT", nullable: false), - Index = table.Column(type: "INTEGER", nullable: false), - ContentMD5 = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_CategoriesPuzzles", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "CategoriesCategory", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Name = table.Column(type: "TEXT", nullable: false), - Color = table.Column(type: "INTEGER", nullable: false), - CategoriesPuzzleId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_CategoriesCategory", x => x.Id); - table.ForeignKey( - name: "FK_CategoriesCategory_CategoriesPuzzles_CategoriesPuzzleId", - column: x => x.CategoriesPuzzleId, - principalTable: "CategoriesPuzzles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "CategoriesCard", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Content = table.Column(type: "TEXT", nullable: false), - Position = table.Column(type: "INTEGER", nullable: false), - CategoriesCategoryId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_CategoriesCard", x => x.Id); - table.ForeignKey( - name: "FK_CategoriesCard_CategoriesCategory_CategoriesCategoryId", - column: x => x.CategoriesCategoryId, - principalTable: "CategoriesCategory", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_CategoriesCard_CategoriesCategoryId", - table: "CategoriesCard", - column: "CategoriesCategoryId"); - - migrationBuilder.CreateIndex( - name: "IX_CategoriesCategory_CategoriesPuzzleId", - table: "CategoriesCategory", - column: "CategoriesPuzzleId"); - - migrationBuilder.CreateIndex( - name: "IX_CategoriesPuzzles_PrintDate", - table: "CategoriesPuzzles", - column: "PrintDate", - unique: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "CategoriesCard"); - - migrationBuilder.DropTable( - name: "CategoriesCategory"); - - migrationBuilder.DropTable( - name: "CategoriesPuzzles"); - - migrationBuilder.CreateTable( - name: "Puzzles", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ContentMD5 = table.Column(type: "TEXT", nullable: false), - CreatedDate = table.Column(type: "TEXT", nullable: false), - EditorName = table.Column(type: "TEXT", nullable: false), - Index = table.Column(type: "INTEGER", nullable: false), - PrintDate = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Puzzles", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "PuzzleCategory", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - PuzzleId = table.Column(type: "INTEGER", nullable: false), - Color = table.Column(type: "INTEGER", nullable: false), - Name = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_PuzzleCategory", x => x.Id); - table.ForeignKey( - name: "FK_PuzzleCategory_Puzzles_PuzzleId", - column: x => x.PuzzleId, - principalTable: "Puzzles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "PuzzleCard", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - PuzzleCategoryId = table.Column(type: "INTEGER", nullable: false), - Content = table.Column(type: "TEXT", nullable: false), - Position = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_PuzzleCard", x => x.Id); - table.ForeignKey( - name: "FK_PuzzleCard_PuzzleCategory_PuzzleCategoryId", - column: x => x.PuzzleCategoryId, - principalTable: "PuzzleCategory", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_PuzzleCard_PuzzleCategoryId", - table: "PuzzleCard", - column: "PuzzleCategoryId"); - - migrationBuilder.CreateIndex( - name: "IX_PuzzleCategory_PuzzleId", - table: "PuzzleCategory", - column: "PuzzleId"); - - migrationBuilder.CreateIndex( - name: "IX_Puzzles_PrintDate", - table: "Puzzles", - column: "PrintDate", - unique: true); - } - } -} diff --git a/Database/Migrations/20241226124356_RenameTablesCorrectly.Designer.cs b/Database/Migrations/20241226124356_RenameTablesCorrectly.Designer.cs deleted file mode 100644 index 93e67ce..0000000 --- a/Database/Migrations/20241226124356_RenameTablesCorrectly.Designer.cs +++ /dev/null @@ -1,136 +0,0 @@ -// -using System; -using ConnectionsAPI.Database; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace ConnectionsAPI.Database.Migrations -{ - [DbContext(typeof(ConnectionsContext))] - [Migration("20241226124356_RenameTablesCorrectly")] - partial class RenameTablesCorrectly - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "8.0.4"); - - modelBuilder.Entity("ConnectionsAPI.Database.Entities.ConnectionsCard", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CategoriesCategoryId") - .HasColumnType("INTEGER"); - - b.Property("CategoryId") - .HasColumnType("INTEGER"); - - b.Property("Content") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Position") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("CategoryId"); - - b.ToTable("ConnectionsCard"); - }); - - modelBuilder.Entity("ConnectionsAPI.Database.Entities.ConnectionsCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Color") - .HasColumnType("INTEGER"); - - b.Property("ConnectionsPuzzleId") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("ConnectionsPuzzleId"); - - b.ToTable("ConnectionsCategory"); - }); - - modelBuilder.Entity("ConnectionsAPI.Database.Entities.ConnectionsPuzzle", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ContentMD5") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("EditorName") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Index") - .HasColumnType("INTEGER"); - - b.Property("PrintDate") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("PrintDate") - .IsUnique(); - - b.ToTable("CategoriesPuzzles"); - }); - - modelBuilder.Entity("ConnectionsAPI.Database.Entities.ConnectionsCard", b => - { - b.HasOne("ConnectionsAPI.Database.Entities.ConnectionsCategory", "Category") - .WithMany("Cards") - .HasForeignKey("CategoryId"); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ConnectionsAPI.Database.Entities.ConnectionsCategory", b => - { - b.HasOne("ConnectionsAPI.Database.Entities.ConnectionsPuzzle", "ConnectionsPuzzle") - .WithMany("Categories") - .HasForeignKey("ConnectionsPuzzleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ConnectionsPuzzle"); - }); - - modelBuilder.Entity("ConnectionsAPI.Database.Entities.ConnectionsCategory", b => - { - b.Navigation("Cards"); - }); - - modelBuilder.Entity("ConnectionsAPI.Database.Entities.ConnectionsPuzzle", b => - { - b.Navigation("Categories"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Database/Migrations/20241226124356_RenameTablesCorrectly.cs b/Database/Migrations/20241226124356_RenameTablesCorrectly.cs deleted file mode 100644 index 4f7e0b4..0000000 --- a/Database/Migrations/20241226124356_RenameTablesCorrectly.cs +++ /dev/null @@ -1,134 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ConnectionsAPI.Database.Migrations -{ - /// - public partial class RenameTablesCorrectly : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "CategoriesCard"); - - migrationBuilder.DropTable( - name: "CategoriesCategory"); - - migrationBuilder.CreateTable( - name: "ConnectionsCategory", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Name = table.Column(type: "TEXT", nullable: false), - Color = table.Column(type: "INTEGER", nullable: false), - ConnectionsPuzzleId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ConnectionsCategory", x => x.Id); - table.ForeignKey( - name: "FK_ConnectionsCategory_CategoriesPuzzles_ConnectionsPuzzleId", - column: x => x.ConnectionsPuzzleId, - principalTable: "CategoriesPuzzles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ConnectionsCard", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Content = table.Column(type: "TEXT", nullable: false), - Position = table.Column(type: "INTEGER", nullable: false), - CategoriesCategoryId = table.Column(type: "INTEGER", nullable: false), - CategoryId = table.Column(type: "INTEGER", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_ConnectionsCard", x => x.Id); - table.ForeignKey( - name: "FK_ConnectionsCard_ConnectionsCategory_CategoryId", - column: x => x.CategoryId, - principalTable: "ConnectionsCategory", - principalColumn: "Id"); - }); - - migrationBuilder.CreateIndex( - name: "IX_ConnectionsCard_CategoryId", - table: "ConnectionsCard", - column: "CategoryId"); - - migrationBuilder.CreateIndex( - name: "IX_ConnectionsCategory_ConnectionsPuzzleId", - table: "ConnectionsCategory", - column: "ConnectionsPuzzleId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ConnectionsCard"); - - migrationBuilder.DropTable( - name: "ConnectionsCategory"); - - migrationBuilder.CreateTable( - name: "CategoriesCategory", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - CategoriesPuzzleId = table.Column(type: "INTEGER", nullable: false), - Color = table.Column(type: "INTEGER", nullable: false), - Name = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_CategoriesCategory", x => x.Id); - table.ForeignKey( - name: "FK_CategoriesCategory_CategoriesPuzzles_CategoriesPuzzleId", - column: x => x.CategoriesPuzzleId, - principalTable: "CategoriesPuzzles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "CategoriesCard", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - CategoriesCategoryId = table.Column(type: "INTEGER", nullable: false), - Content = table.Column(type: "TEXT", nullable: false), - Position = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_CategoriesCard", x => x.Id); - table.ForeignKey( - name: "FK_CategoriesCard_CategoriesCategory_CategoriesCategoryId", - column: x => x.CategoriesCategoryId, - principalTable: "CategoriesCategory", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_CategoriesCard_CategoriesCategoryId", - table: "CategoriesCard", - column: "CategoriesCategoryId"); - - migrationBuilder.CreateIndex( - name: "IX_CategoriesCategory_CategoriesPuzzleId", - table: "CategoriesCategory", - column: "CategoriesPuzzleId"); - } - } -} diff --git a/Database/Migrations/20241226124529_RenameCollectionsTable.Designer.cs b/Database/Migrations/20241226124529_RenameCollectionsTable.Designer.cs deleted file mode 100644 index 2d806fc..0000000 --- a/Database/Migrations/20241226124529_RenameCollectionsTable.Designer.cs +++ /dev/null @@ -1,136 +0,0 @@ -// -using System; -using ConnectionsAPI.Database; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace ConnectionsAPI.Database.Migrations -{ - [DbContext(typeof(ConnectionsContext))] - [Migration("20241226124529_RenameCollectionsTable")] - partial class RenameCollectionsTable - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "8.0.4"); - - modelBuilder.Entity("ConnectionsAPI.Database.Entities.ConnectionsCard", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("CategoriesCategoryId") - .HasColumnType("INTEGER"); - - b.Property("CategoryId") - .HasColumnType("INTEGER"); - - b.Property("Content") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Position") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("CategoryId"); - - b.ToTable("ConnectionsCard"); - }); - - modelBuilder.Entity("ConnectionsAPI.Database.Entities.ConnectionsCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Color") - .HasColumnType("INTEGER"); - - b.Property("ConnectionsPuzzleId") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("ConnectionsPuzzleId"); - - b.ToTable("ConnectionsCategory"); - }); - - modelBuilder.Entity("ConnectionsAPI.Database.Entities.ConnectionsPuzzle", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ContentMD5") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("CreatedDate") - .HasColumnType("TEXT"); - - b.Property("EditorName") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Index") - .HasColumnType("INTEGER"); - - b.Property("PrintDate") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("PrintDate") - .IsUnique(); - - b.ToTable("ConnectionsPuzzles"); - }); - - modelBuilder.Entity("ConnectionsAPI.Database.Entities.ConnectionsCard", b => - { - b.HasOne("ConnectionsAPI.Database.Entities.ConnectionsCategory", "Category") - .WithMany("Cards") - .HasForeignKey("CategoryId"); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("ConnectionsAPI.Database.Entities.ConnectionsCategory", b => - { - b.HasOne("ConnectionsAPI.Database.Entities.ConnectionsPuzzle", "ConnectionsPuzzle") - .WithMany("Categories") - .HasForeignKey("ConnectionsPuzzleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("ConnectionsPuzzle"); - }); - - modelBuilder.Entity("ConnectionsAPI.Database.Entities.ConnectionsCategory", b => - { - b.Navigation("Cards"); - }); - - modelBuilder.Entity("ConnectionsAPI.Database.Entities.ConnectionsPuzzle", b => - { - b.Navigation("Categories"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Database/Migrations/20241226124529_RenameCollectionsTable.cs b/Database/Migrations/20241226124529_RenameCollectionsTable.cs deleted file mode 100644 index 46e393d..0000000 --- a/Database/Migrations/20241226124529_RenameCollectionsTable.cs +++ /dev/null @@ -1,78 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ConnectionsAPI.Database.Migrations -{ - /// - public partial class RenameCollectionsTable : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_ConnectionsCategory_CategoriesPuzzles_ConnectionsPuzzleId", - table: "ConnectionsCategory"); - - migrationBuilder.DropPrimaryKey( - name: "PK_CategoriesPuzzles", - table: "CategoriesPuzzles"); - - migrationBuilder.RenameTable( - name: "CategoriesPuzzles", - newName: "ConnectionsPuzzles"); - - migrationBuilder.RenameIndex( - name: "IX_CategoriesPuzzles_PrintDate", - table: "ConnectionsPuzzles", - newName: "IX_ConnectionsPuzzles_PrintDate"); - - migrationBuilder.AddPrimaryKey( - name: "PK_ConnectionsPuzzles", - table: "ConnectionsPuzzles", - column: "Id"); - - migrationBuilder.AddForeignKey( - name: "FK_ConnectionsCategory_ConnectionsPuzzles_ConnectionsPuzzleId", - table: "ConnectionsCategory", - column: "ConnectionsPuzzleId", - principalTable: "ConnectionsPuzzles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_ConnectionsCategory_ConnectionsPuzzles_ConnectionsPuzzleId", - table: "ConnectionsCategory"); - - migrationBuilder.DropPrimaryKey( - name: "PK_ConnectionsPuzzles", - table: "ConnectionsPuzzles"); - - migrationBuilder.RenameTable( - name: "ConnectionsPuzzles", - newName: "CategoriesPuzzles"); - - migrationBuilder.RenameIndex( - name: "IX_ConnectionsPuzzles_PrintDate", - table: "CategoriesPuzzles", - newName: "IX_CategoriesPuzzles_PrintDate"); - - migrationBuilder.AddPrimaryKey( - name: "PK_CategoriesPuzzles", - table: "CategoriesPuzzles", - column: "Id"); - - migrationBuilder.AddForeignKey( - name: "FK_ConnectionsCategory_CategoriesPuzzles_ConnectionsPuzzleId", - table: "ConnectionsCategory", - column: "ConnectionsPuzzleId", - principalTable: "CategoriesPuzzles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - } -} diff --git a/Database/Migrations/20241226131510_RenameCategoriesPuzzles2.cs b/Database/Migrations/20241226131510_RenameCategoriesPuzzles2.cs deleted file mode 100644 index 2dee41e..0000000 --- a/Database/Migrations/20241226131510_RenameCategoriesPuzzles2.cs +++ /dev/null @@ -1,79 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace ConnectionsAPI.Database.Migrations -{ - /// - public partial class RenameCategoriesPuzzles2 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_ConnectionsCard_ConnectionsCategory_CategoryId", - table: "ConnectionsCard"); - - migrationBuilder.DropIndex( - name: "IX_ConnectionsCard_CategoryId", - table: "ConnectionsCard"); - - migrationBuilder.DropColumn( - name: "CategoryId", - table: "ConnectionsCard"); - - migrationBuilder.RenameColumn( - name: "CategoriesCategoryId", - table: "ConnectionsCard", - newName: "ConnectionsCategoryId"); - - migrationBuilder.CreateIndex( - name: "IX_ConnectionsCard_ConnectionsCategoryId", - table: "ConnectionsCard", - column: "ConnectionsCategoryId"); - - migrationBuilder.AddForeignKey( - name: "FK_ConnectionsCard_ConnectionsCategory_ConnectionsCategoryId", - table: "ConnectionsCard", - column: "ConnectionsCategoryId", - principalTable: "ConnectionsCategory", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_ConnectionsCard_ConnectionsCategory_ConnectionsCategoryId", - table: "ConnectionsCard"); - - migrationBuilder.DropIndex( - name: "IX_ConnectionsCard_ConnectionsCategoryId", - table: "ConnectionsCard"); - - migrationBuilder.RenameColumn( - name: "ConnectionsCategoryId", - table: "ConnectionsCard", - newName: "CategoriesCategoryId"); - - migrationBuilder.AddColumn( - name: "CategoryId", - table: "ConnectionsCard", - type: "INTEGER", - nullable: true); - - migrationBuilder.CreateIndex( - name: "IX_ConnectionsCard_CategoryId", - table: "ConnectionsCard", - column: "CategoryId"); - - migrationBuilder.AddForeignKey( - name: "FK_ConnectionsCard_ConnectionsCategory_CategoryId", - table: "ConnectionsCard", - column: "CategoryId", - principalTable: "ConnectionsCategory", - principalColumn: "Id"); - } - } -} diff --git a/Database/Migrations/20241226131510_RenameCategoriesPuzzles2.Designer.cs b/Database/Migrations/20241226132528_InitialRecreate.Designer.cs similarity index 97% rename from Database/Migrations/20241226131510_RenameCategoriesPuzzles2.Designer.cs rename to Database/Migrations/20241226132528_InitialRecreate.Designer.cs index 38a8acc..6552b2d 100644 --- a/Database/Migrations/20241226131510_RenameCategoriesPuzzles2.Designer.cs +++ b/Database/Migrations/20241226132528_InitialRecreate.Designer.cs @@ -11,8 +11,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace ConnectionsAPI.Database.Migrations { [DbContext(typeof(ConnectionsContext))] - [Migration("20241226131510_RenameCategoriesPuzzles2")] - partial class RenameCategoriesPuzzles2 + [Migration("20241226132528_InitialRecreate")] + partial class InitialRecreate { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) diff --git a/Database/Migrations/20240416121538_Initial.cs b/Database/Migrations/20241226132528_InitialRecreate.cs similarity index 63% rename from Database/Migrations/20240416121538_Initial.cs rename to Database/Migrations/20241226132528_InitialRecreate.cs index 52dfd79..c07301e 100644 --- a/Database/Migrations/20240416121538_Initial.cs +++ b/Database/Migrations/20241226132528_InitialRecreate.cs @@ -6,13 +6,13 @@ using Microsoft.EntityFrameworkCore.Migrations; namespace ConnectionsAPI.Database.Migrations { /// - public partial class Initial : Migration + public partial class InitialRecreate : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( - name: "Puzzles", + name: "ConnectionsPuzzles", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) @@ -25,64 +25,64 @@ namespace ConnectionsAPI.Database.Migrations }, constraints: table => { - table.PrimaryKey("PK_Puzzles", x => x.Id); + table.PrimaryKey("PK_ConnectionsPuzzles", x => x.Id); }); migrationBuilder.CreateTable( - name: "PuzzleCategory", + name: "ConnectionsCategory", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Name = table.Column(type: "TEXT", nullable: false), Color = table.Column(type: "INTEGER", nullable: false), - PuzzleId = table.Column(type: "INTEGER", nullable: false) + ConnectionsPuzzleId = table.Column(type: "INTEGER", nullable: false) }, constraints: table => { - table.PrimaryKey("PK_PuzzleCategory", x => x.Id); + table.PrimaryKey("PK_ConnectionsCategory", x => x.Id); table.ForeignKey( - name: "FK_PuzzleCategory_Puzzles_PuzzleId", - column: x => x.PuzzleId, - principalTable: "Puzzles", + name: "FK_ConnectionsCategory_ConnectionsPuzzles_ConnectionsPuzzleId", + column: x => x.ConnectionsPuzzleId, + principalTable: "ConnectionsPuzzles", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( - name: "PuzzleCard", + name: "ConnectionsCard", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Content = table.Column(type: "TEXT", nullable: false), Position = table.Column(type: "INTEGER", nullable: false), - PuzzleCategoryId = table.Column(type: "INTEGER", nullable: false) + ConnectionsCategoryId = table.Column(type: "INTEGER", nullable: false) }, constraints: table => { - table.PrimaryKey("PK_PuzzleCard", x => x.Id); + table.PrimaryKey("PK_ConnectionsCard", x => x.Id); table.ForeignKey( - name: "FK_PuzzleCard_PuzzleCategory_PuzzleCategoryId", - column: x => x.PuzzleCategoryId, - principalTable: "PuzzleCategory", + name: "FK_ConnectionsCard_ConnectionsCategory_ConnectionsCategoryId", + column: x => x.ConnectionsCategoryId, + principalTable: "ConnectionsCategory", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( - name: "IX_PuzzleCard_PuzzleCategoryId", - table: "PuzzleCard", - column: "PuzzleCategoryId"); + name: "IX_ConnectionsCard_ConnectionsCategoryId", + table: "ConnectionsCard", + column: "ConnectionsCategoryId"); migrationBuilder.CreateIndex( - name: "IX_PuzzleCategory_PuzzleId", - table: "PuzzleCategory", - column: "PuzzleId"); + name: "IX_ConnectionsCategory_ConnectionsPuzzleId", + table: "ConnectionsCategory", + column: "ConnectionsPuzzleId"); migrationBuilder.CreateIndex( - name: "IX_Puzzles_PrintDate", - table: "Puzzles", + name: "IX_ConnectionsPuzzles_PrintDate", + table: "ConnectionsPuzzles", column: "PrintDate", unique: true); } @@ -91,13 +91,13 @@ namespace ConnectionsAPI.Database.Migrations protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( - name: "PuzzleCard"); + name: "ConnectionsCard"); migrationBuilder.DropTable( - name: "PuzzleCategory"); + name: "ConnectionsCategory"); migrationBuilder.DropTable( - name: "Puzzles"); + name: "ConnectionsPuzzles"); } } }