refactor: Refactor Get connections
This commit is contained in:
135
Database/Migrations/20241226131510_RenameCategoriesPuzzles2.Designer.cs
generated
Normal file
135
Database/Migrations/20241226131510_RenameCategoriesPuzzles2.Designer.cs
generated
Normal file
@@ -0,0 +1,135 @@
|
||||
// <auto-generated />
|
||||
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("20241226131510_RenameCategoriesPuzzles2")]
|
||||
partial class RenameCategoriesPuzzles2
|
||||
{
|
||||
/// <inheritdoc />
|
||||
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<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("ConnectionsCategoryId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Content")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("Position")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ConnectionsCategoryId");
|
||||
|
||||
b.ToTable("ConnectionsCard");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ConnectionsAPI.Database.Entities.ConnectionsCategory", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Color")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("ConnectionsPuzzleId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ConnectionsPuzzleId");
|
||||
|
||||
b.ToTable("ConnectionsCategory");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ConnectionsAPI.Database.Entities.ConnectionsPuzzle", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("ContentMD5")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedDate")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("EditorName")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("Index")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("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("ConnectionsCategoryId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ConnectionsAPI.Database.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class RenameCategoriesPuzzles2 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
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);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
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<int>(
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,10 +23,7 @@ namespace ConnectionsAPI.Database.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("CategoriesCategoryId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int?>("CategoryId")
|
||||
b.Property<int>("ConnectionsCategoryId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Content")
|
||||
@@ -38,7 +35,7 @@ namespace ConnectionsAPI.Database.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CategoryId");
|
||||
b.HasIndex("ConnectionsCategoryId");
|
||||
|
||||
b.ToTable("ConnectionsCard");
|
||||
});
|
||||
@@ -102,7 +99,9 @@ namespace ConnectionsAPI.Database.Migrations
|
||||
{
|
||||
b.HasOne("ConnectionsAPI.Database.Entities.ConnectionsCategory", "Category")
|
||||
.WithMany("Cards")
|
||||
.HasForeignKey("CategoryId");
|
||||
.HasForeignKey("ConnectionsCategoryId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Category");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user