Reusable db stuff??

This commit is contained in:
Lani Aung
2024-09-15 21:59:05 -06:00
parent 009efc4643
commit c805414cab
28 changed files with 71 additions and 32 deletions
@@ -0,0 +1,8 @@
namespace fxl.codes.kisekae.data.Entities
{
public class Action
{
public int Id { get; set; }
public string Name { get; set; }
}
}
+14
View File
@@ -0,0 +1,14 @@
namespace fxl.codes.kisekae.data.Entities
{
public class Cel
{
public int Id { get; set; }
public string FileName { get; set; }
public byte[] Data { get; set; }
public int OffsetX { get; set; }
public int OffsetY { get; set; }
public int Height { get; set; }
public int Width { get; set; }
public Kisekae Kisekae { get; set; }
}
}
@@ -0,0 +1,18 @@
namespace fxl.codes.kisekae.data.Entities
{
public class CelConfig
{
public int Id { get; set; }
public Cel Cel { get; set; }
public Configuration Configuration { get; set; }
public int Mark { get; set; }
public int Fix { get; set; }
public Palette Palette { get; set; }
public int PaletteGroup { get; set; }
public string Comment { get; set; }
public int Transparency { get; set; }
public Render Render { get; set; }
public List<CelPosition> Positions { get; set; } = new();
public bool[] Sets { get; set; } = new bool[10];
}
}
@@ -0,0 +1,10 @@
namespace fxl.codes.kisekae.data.Entities
{
public class CelPosition
{
public int Id { get; set; }
public int Set { get; set; }
public int X { get; set; }
public int Y { get; set; }
}
}
@@ -0,0 +1,16 @@
namespace fxl.codes.kisekae.data.Entities
{
public class Configuration
{
public int Id { get; set; }
public string Name { get; set; }
public Kisekae Kisekae { get; set; }
public List<CelConfig> Cels { get; set; } = new();
public List<Action> Actions { get; set; } = new();
public string Data { get; set; }
public int Height { get; set; }
public int Width { get; set; }
public string BackgroundColorHex { get; set; }
}
}
@@ -0,0 +1,12 @@
namespace fxl.codes.kisekae.data.Entities
{
public class Kisekae
{
public int Id { get; set; }
public string FileName { get; set; }
public string CheckSum { get; set; }
public List<Configuration> Configurations { get; set; } = new();
public List<Cel> Cels { get; set; } = new();
public List<Palette> Palettes { get; set; } = new();
}
}
@@ -0,0 +1,11 @@
namespace fxl.codes.kisekae.data.Entities
{
public class Palette
{
public int Id { get; set; }
public Kisekae Kisekae { get; set; }
public string FileName { get; set; }
public List<PaletteColor> Colors { get; set; } = new();
public byte[] Data { get; set; }
}
}
@@ -0,0 +1,10 @@
namespace fxl.codes.kisekae.data.Entities
{
public class PaletteColor
{
public int Id { get; set; }
public Palette Palette { get; set; }
public int Group { get; set; }
public string Hex { get; set; }
}
}
@@ -0,0 +1,8 @@
namespace fxl.codes.kisekae.data.Entities
{
public class Render
{
public int Id { get; set; }
public byte[] Image { get; set; }
}
}
+26
View File
@@ -0,0 +1,26 @@
using fxl.codes.kisekae.data.Entities;
using Microsoft.EntityFrameworkCore;
namespace fxl.codes.kisekae.data
{
public class KisekaeContext : DbContext
{
public KisekaeContext(DbContextOptions<KisekaeContext> options) : base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<CelConfig>().Ignore(x => x.Sets);
base.OnModelCreating(modelBuilder);
}
public DbSet<Kisekae> KisekaeSets { get; set; }
public DbSet<Configuration> Configurations { get; set; }
public DbSet<Cel> Cels { get; set; }
public DbSet<CelConfig> CelConfigs { get; set; }
public DbSet<Render> Renders { get; set; }
public DbSet<Palette> Palettes { get; set; }
public DbSet<PaletteColor> PaletteColors { get; set; }
}
}
@@ -0,0 +1,382 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using fxl.codes.kisekae;
using fxl.codes.kisekae.data;
#nullable disable
namespace fxl.codes.kisekae.Migrations
{
[DbContext(typeof(KisekaeContext))]
[Migration("20240212041548_init")]
partial class init
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.1")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("fxl.codes.kisekae.Entities.Action", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int?>("ConfigurationId")
.HasColumnType("integer");
b.Property<string>("Name")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ConfigurationId");
b.ToTable("Action");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.Cel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<byte[]>("Data")
.HasColumnType("bytea");
b.Property<string>("FileName")
.HasColumnType("text");
b.Property<int>("Height")
.HasColumnType("integer");
b.Property<int?>("KisekaeId")
.HasColumnType("integer");
b.Property<int>("OffsetX")
.HasColumnType("integer");
b.Property<int>("OffsetY")
.HasColumnType("integer");
b.Property<int>("Width")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("KisekaeId");
b.ToTable("Cels");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.CelConfig", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int?>("CelId")
.HasColumnType("integer");
b.Property<string>("Comment")
.HasColumnType("text");
b.Property<int?>("ConfigurationId")
.HasColumnType("integer");
b.Property<int>("Fix")
.HasColumnType("integer");
b.Property<int>("Mark")
.HasColumnType("integer");
b.Property<int>("PaletteGroup")
.HasColumnType("integer");
b.Property<int?>("PaletteId")
.HasColumnType("integer");
b.Property<int?>("RenderId")
.HasColumnType("integer");
b.Property<int>("Transparency")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("CelId");
b.HasIndex("ConfigurationId");
b.HasIndex("PaletteId");
b.HasIndex("RenderId");
b.ToTable("CelConfigs");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.CelPosition", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int?>("CelConfigId")
.HasColumnType("integer");
b.Property<int>("Set")
.HasColumnType("integer");
b.Property<int>("X")
.HasColumnType("integer");
b.Property<int>("Y")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("CelConfigId");
b.ToTable("CelPosition");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.Configuration", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("BackgroundColorHex")
.HasColumnType("text");
b.Property<string>("Data")
.HasColumnType("text");
b.Property<int>("Height")
.HasColumnType("integer");
b.Property<int?>("KisekaeId")
.HasColumnType("integer");
b.Property<string>("Name")
.HasColumnType("text");
b.Property<int>("Width")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("KisekaeId");
b.ToTable("Configurations");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.Kisekae", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("CheckSum")
.HasColumnType("text");
b.Property<string>("FileName")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("KisekaeSets");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.Palette", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<byte[]>("Data")
.HasColumnType("bytea");
b.Property<string>("FileName")
.HasColumnType("text");
b.Property<int?>("KisekaeId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("KisekaeId");
b.ToTable("Palettes");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.PaletteColor", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("Group")
.HasColumnType("integer");
b.Property<string>("Hex")
.HasColumnType("text");
b.Property<int?>("PaletteId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("PaletteId");
b.ToTable("PaletteColors");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.Render", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<byte[]>("Image")
.HasColumnType("bytea");
b.HasKey("Id");
b.ToTable("Renders");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.Action", b =>
{
b.HasOne("fxl.codes.kisekae.Entities.Configuration", null)
.WithMany("Actions")
.HasForeignKey("ConfigurationId");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.Cel", b =>
{
b.HasOne("fxl.codes.kisekae.Entities.Kisekae", "Kisekae")
.WithMany("Cels")
.HasForeignKey("KisekaeId");
b.Navigation("Kisekae");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.CelConfig", b =>
{
b.HasOne("fxl.codes.kisekae.Entities.Cel", "Cel")
.WithMany()
.HasForeignKey("CelId");
b.HasOne("fxl.codes.kisekae.Entities.Configuration", "Configuration")
.WithMany("Cels")
.HasForeignKey("ConfigurationId");
b.HasOne("fxl.codes.kisekae.Entities.Palette", "Palette")
.WithMany()
.HasForeignKey("PaletteId");
b.HasOne("fxl.codes.kisekae.Entities.Render", "Render")
.WithMany()
.HasForeignKey("RenderId");
b.Navigation("Cel");
b.Navigation("Configuration");
b.Navigation("Palette");
b.Navigation("Render");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.CelPosition", b =>
{
b.HasOne("fxl.codes.kisekae.Entities.CelConfig", null)
.WithMany("Positions")
.HasForeignKey("CelConfigId");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.Configuration", b =>
{
b.HasOne("fxl.codes.kisekae.Entities.Kisekae", "Kisekae")
.WithMany("Configurations")
.HasForeignKey("KisekaeId");
b.Navigation("Kisekae");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.Palette", b =>
{
b.HasOne("fxl.codes.kisekae.Entities.Kisekae", "Kisekae")
.WithMany("Palettes")
.HasForeignKey("KisekaeId");
b.Navigation("Kisekae");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.PaletteColor", b =>
{
b.HasOne("fxl.codes.kisekae.Entities.Palette", "Palette")
.WithMany("Colors")
.HasForeignKey("PaletteId");
b.Navigation("Palette");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.CelConfig", b =>
{
b.Navigation("Positions");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.Configuration", b =>
{
b.Navigation("Actions");
b.Navigation("Cels");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.Kisekae", b =>
{
b.Navigation("Cels");
b.Navigation("Configurations");
b.Navigation("Palettes");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.Palette", b =>
{
b.Navigation("Colors");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,291 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace fxl.codes.kisekae.Migrations
{
/// <inheritdoc />
public partial class init : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "KisekaeSets",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
FileName = table.Column<string>(type: "text", nullable: true),
CheckSum = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_KisekaeSets", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Renders",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Image = table.Column<byte[]>(type: "bytea", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Renders", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Cels",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
FileName = table.Column<string>(type: "text", nullable: true),
Data = table.Column<byte[]>(type: "bytea", nullable: true),
OffsetX = table.Column<int>(type: "integer", nullable: false),
OffsetY = table.Column<int>(type: "integer", nullable: false),
Height = table.Column<int>(type: "integer", nullable: false),
Width = table.Column<int>(type: "integer", nullable: false),
KisekaeId = table.Column<int>(type: "integer", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Cels", x => x.Id);
table.ForeignKey(
name: "FK_Cels_KisekaeSets_KisekaeId",
column: x => x.KisekaeId,
principalTable: "KisekaeSets",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "Configurations",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "text", nullable: true),
KisekaeId = table.Column<int>(type: "integer", nullable: true),
Data = table.Column<string>(type: "text", nullable: true),
Height = table.Column<int>(type: "integer", nullable: false),
Width = table.Column<int>(type: "integer", nullable: false),
BackgroundColorHex = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Configurations", x => x.Id);
table.ForeignKey(
name: "FK_Configurations_KisekaeSets_KisekaeId",
column: x => x.KisekaeId,
principalTable: "KisekaeSets",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "Palettes",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
KisekaeId = table.Column<int>(type: "integer", nullable: true),
FileName = table.Column<string>(type: "text", nullable: true),
Data = table.Column<byte[]>(type: "bytea", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Palettes", x => x.Id);
table.ForeignKey(
name: "FK_Palettes_KisekaeSets_KisekaeId",
column: x => x.KisekaeId,
principalTable: "KisekaeSets",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "Action",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "text", nullable: true),
ConfigurationId = table.Column<int>(type: "integer", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Action", x => x.Id);
table.ForeignKey(
name: "FK_Action_Configurations_ConfigurationId",
column: x => x.ConfigurationId,
principalTable: "Configurations",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "CelConfigs",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
CelId = table.Column<int>(type: "integer", nullable: true),
ConfigurationId = table.Column<int>(type: "integer", nullable: true),
Mark = table.Column<int>(type: "integer", nullable: false),
Fix = table.Column<int>(type: "integer", nullable: false),
PaletteId = table.Column<int>(type: "integer", nullable: true),
PaletteGroup = table.Column<int>(type: "integer", nullable: false),
Comment = table.Column<string>(type: "text", nullable: true),
Transparency = table.Column<int>(type: "integer", nullable: false),
RenderId = table.Column<int>(type: "integer", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CelConfigs", x => x.Id);
table.ForeignKey(
name: "FK_CelConfigs_Cels_CelId",
column: x => x.CelId,
principalTable: "Cels",
principalColumn: "Id");
table.ForeignKey(
name: "FK_CelConfigs_Configurations_ConfigurationId",
column: x => x.ConfigurationId,
principalTable: "Configurations",
principalColumn: "Id");
table.ForeignKey(
name: "FK_CelConfigs_Palettes_PaletteId",
column: x => x.PaletteId,
principalTable: "Palettes",
principalColumn: "Id");
table.ForeignKey(
name: "FK_CelConfigs_Renders_RenderId",
column: x => x.RenderId,
principalTable: "Renders",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "PaletteColors",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
PaletteId = table.Column<int>(type: "integer", nullable: true),
Group = table.Column<int>(type: "integer", nullable: false),
Hex = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_PaletteColors", x => x.Id);
table.ForeignKey(
name: "FK_PaletteColors_Palettes_PaletteId",
column: x => x.PaletteId,
principalTable: "Palettes",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "CelPosition",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Set = table.Column<int>(type: "integer", nullable: false),
X = table.Column<int>(type: "integer", nullable: false),
Y = table.Column<int>(type: "integer", nullable: false),
CelConfigId = table.Column<int>(type: "integer", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CelPosition", x => x.Id);
table.ForeignKey(
name: "FK_CelPosition_CelConfigs_CelConfigId",
column: x => x.CelConfigId,
principalTable: "CelConfigs",
principalColumn: "Id");
});
migrationBuilder.CreateIndex(
name: "IX_Action_ConfigurationId",
table: "Action",
column: "ConfigurationId");
migrationBuilder.CreateIndex(
name: "IX_CelConfigs_CelId",
table: "CelConfigs",
column: "CelId");
migrationBuilder.CreateIndex(
name: "IX_CelConfigs_ConfigurationId",
table: "CelConfigs",
column: "ConfigurationId");
migrationBuilder.CreateIndex(
name: "IX_CelConfigs_PaletteId",
table: "CelConfigs",
column: "PaletteId");
migrationBuilder.CreateIndex(
name: "IX_CelConfigs_RenderId",
table: "CelConfigs",
column: "RenderId");
migrationBuilder.CreateIndex(
name: "IX_CelPosition_CelConfigId",
table: "CelPosition",
column: "CelConfigId");
migrationBuilder.CreateIndex(
name: "IX_Cels_KisekaeId",
table: "Cels",
column: "KisekaeId");
migrationBuilder.CreateIndex(
name: "IX_Configurations_KisekaeId",
table: "Configurations",
column: "KisekaeId");
migrationBuilder.CreateIndex(
name: "IX_PaletteColors_PaletteId",
table: "PaletteColors",
column: "PaletteId");
migrationBuilder.CreateIndex(
name: "IX_Palettes_KisekaeId",
table: "Palettes",
column: "KisekaeId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Action");
migrationBuilder.DropTable(
name: "CelPosition");
migrationBuilder.DropTable(
name: "PaletteColors");
migrationBuilder.DropTable(
name: "CelConfigs");
migrationBuilder.DropTable(
name: "Cels");
migrationBuilder.DropTable(
name: "Configurations");
migrationBuilder.DropTable(
name: "Palettes");
migrationBuilder.DropTable(
name: "Renders");
migrationBuilder.DropTable(
name: "KisekaeSets");
}
}
}
@@ -0,0 +1,379 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using fxl.codes.kisekae;
using fxl.codes.kisekae.data;
#nullable disable
namespace fxl.codes.kisekae.Migrations
{
[DbContext(typeof(KisekaeContext))]
partial class KisekaeContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.1")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("fxl.codes.kisekae.Entities.Action", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int?>("ConfigurationId")
.HasColumnType("integer");
b.Property<string>("Name")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("ConfigurationId");
b.ToTable("Action");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.Cel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<byte[]>("Data")
.HasColumnType("bytea");
b.Property<string>("FileName")
.HasColumnType("text");
b.Property<int>("Height")
.HasColumnType("integer");
b.Property<int?>("KisekaeId")
.HasColumnType("integer");
b.Property<int>("OffsetX")
.HasColumnType("integer");
b.Property<int>("OffsetY")
.HasColumnType("integer");
b.Property<int>("Width")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("KisekaeId");
b.ToTable("Cels");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.CelConfig", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int?>("CelId")
.HasColumnType("integer");
b.Property<string>("Comment")
.HasColumnType("text");
b.Property<int?>("ConfigurationId")
.HasColumnType("integer");
b.Property<int>("Fix")
.HasColumnType("integer");
b.Property<int>("Mark")
.HasColumnType("integer");
b.Property<int>("PaletteGroup")
.HasColumnType("integer");
b.Property<int?>("PaletteId")
.HasColumnType("integer");
b.Property<int?>("RenderId")
.HasColumnType("integer");
b.Property<int>("Transparency")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("CelId");
b.HasIndex("ConfigurationId");
b.HasIndex("PaletteId");
b.HasIndex("RenderId");
b.ToTable("CelConfigs");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.CelPosition", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int?>("CelConfigId")
.HasColumnType("integer");
b.Property<int>("Set")
.HasColumnType("integer");
b.Property<int>("X")
.HasColumnType("integer");
b.Property<int>("Y")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("CelConfigId");
b.ToTable("CelPosition");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.Configuration", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("BackgroundColorHex")
.HasColumnType("text");
b.Property<string>("Data")
.HasColumnType("text");
b.Property<int>("Height")
.HasColumnType("integer");
b.Property<int?>("KisekaeId")
.HasColumnType("integer");
b.Property<string>("Name")
.HasColumnType("text");
b.Property<int>("Width")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("KisekaeId");
b.ToTable("Configurations");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.Kisekae", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("CheckSum")
.HasColumnType("text");
b.Property<string>("FileName")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("KisekaeSets");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.Palette", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<byte[]>("Data")
.HasColumnType("bytea");
b.Property<string>("FileName")
.HasColumnType("text");
b.Property<int?>("KisekaeId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("KisekaeId");
b.ToTable("Palettes");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.PaletteColor", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("Group")
.HasColumnType("integer");
b.Property<string>("Hex")
.HasColumnType("text");
b.Property<int?>("PaletteId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("PaletteId");
b.ToTable("PaletteColors");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.Render", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<byte[]>("Image")
.HasColumnType("bytea");
b.HasKey("Id");
b.ToTable("Renders");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.Action", b =>
{
b.HasOne("fxl.codes.kisekae.Entities.Configuration", null)
.WithMany("Actions")
.HasForeignKey("ConfigurationId");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.Cel", b =>
{
b.HasOne("fxl.codes.kisekae.Entities.Kisekae", "Kisekae")
.WithMany("Cels")
.HasForeignKey("KisekaeId");
b.Navigation("Kisekae");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.CelConfig", b =>
{
b.HasOne("fxl.codes.kisekae.Entities.Cel", "Cel")
.WithMany()
.HasForeignKey("CelId");
b.HasOne("fxl.codes.kisekae.Entities.Configuration", "Configuration")
.WithMany("Cels")
.HasForeignKey("ConfigurationId");
b.HasOne("fxl.codes.kisekae.Entities.Palette", "Palette")
.WithMany()
.HasForeignKey("PaletteId");
b.HasOne("fxl.codes.kisekae.Entities.Render", "Render")
.WithMany()
.HasForeignKey("RenderId");
b.Navigation("Cel");
b.Navigation("Configuration");
b.Navigation("Palette");
b.Navigation("Render");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.CelPosition", b =>
{
b.HasOne("fxl.codes.kisekae.Entities.CelConfig", null)
.WithMany("Positions")
.HasForeignKey("CelConfigId");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.Configuration", b =>
{
b.HasOne("fxl.codes.kisekae.Entities.Kisekae", "Kisekae")
.WithMany("Configurations")
.HasForeignKey("KisekaeId");
b.Navigation("Kisekae");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.Palette", b =>
{
b.HasOne("fxl.codes.kisekae.Entities.Kisekae", "Kisekae")
.WithMany("Palettes")
.HasForeignKey("KisekaeId");
b.Navigation("Kisekae");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.PaletteColor", b =>
{
b.HasOne("fxl.codes.kisekae.Entities.Palette", "Palette")
.WithMany("Colors")
.HasForeignKey("PaletteId");
b.Navigation("Palette");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.CelConfig", b =>
{
b.Navigation("Positions");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.Configuration", b =>
{
b.Navigation("Actions");
b.Navigation("Cels");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.Kisekae", b =>
{
b.Navigation("Cels");
b.Navigation("Configurations");
b.Navigation("Palettes");
});
modelBuilder.Entity("fxl.codes.kisekae.Entities.Palette", b =>
{
b.Navigation("Colors");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.8" />
<PackageReference Include="Npgsql" Version="8.0.4" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.4" />
</ItemGroup>
</Project>