feat: disable identity auto-generation for reference/lookup tables

Reference tables (Province, City, BasicTable, IncomeCostTitle, UnitState, Transaction) require stable, manually assigned IDs that are cross-referenced by other entities. Identity auto-generation is disabled to allow explicit ID assignment from seed data.
This commit is contained in:
2026-06-09 02:40:13 +03:30
parent 6644db7e78
commit 0e1b0345ec
4 changed files with 74 additions and 79 deletions

View File

@@ -25,11 +25,8 @@ namespace Complex.Infrastructure.Migrations
modelBuilder.Entity("Complex.Domain.Entities.BasicTable", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<string>("Discriminator")
.IsRequired()
.HasColumnType("nvarchar(max)");
@@ -75,11 +72,8 @@ namespace Complex.Infrastructure.Migrations
modelBuilder.Entity("Complex.Domain.Entities.City", b =>
{
b.Property<int>("CityId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("CityId"), 1L, 1);
b.Property<string>("CityTitle")
.HasColumnType("nvarchar(max)");
@@ -117,7 +111,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasDefaultValue(new DateTime(2026, 6, 9, 2, 21, 59, 646, DateTimeKind.Local).AddTicks(1882));
.HasDefaultValue(new DateTime(2026, 6, 9, 2, 28, 45, 623, DateTimeKind.Local).AddTicks(7632));
b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd()
@@ -176,7 +170,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasDefaultValue(new DateTime(2026, 6, 9, 2, 21, 59, 646, DateTimeKind.Local).AddTicks(3884));
.HasDefaultValue(new DateTime(2026, 6, 9, 2, 28, 45, 624, DateTimeKind.Local).AddTicks(2426));
b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd()
@@ -252,7 +246,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasDefaultValue(new DateTime(2026, 6, 9, 2, 21, 59, 646, DateTimeKind.Local).AddTicks(4981));
.HasDefaultValue(new DateTime(2026, 6, 9, 2, 28, 45, 624, DateTimeKind.Local).AddTicks(5016));
b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd()
@@ -304,7 +298,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasDefaultValue(new DateTime(2026, 6, 9, 2, 21, 59, 646, DateTimeKind.Local).AddTicks(6348));
.HasDefaultValue(new DateTime(2026, 6, 9, 2, 28, 45, 624, DateTimeKind.Local).AddTicks(7249));
b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd()
@@ -336,18 +330,15 @@ namespace Complex.Infrastructure.Migrations
modelBuilder.Entity("Complex.Domain.Entities.IncomeCostTitle", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<Guid?>("ComplexId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasDefaultValue(new DateTime(2026, 6, 9, 2, 21, 59, 646, DateTimeKind.Local).AddTicks(8225));
.HasDefaultValue(new DateTime(2026, 6, 9, 2, 28, 45, 624, DateTimeKind.Local).AddTicks(9858));
b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd()
@@ -395,7 +386,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasDefaultValue(new DateTime(2026, 6, 9, 2, 21, 59, 647, DateTimeKind.Local).AddTicks(86));
.HasDefaultValue(new DateTime(2026, 6, 9, 2, 28, 45, 625, DateTimeKind.Local).AddTicks(1728));
b.Property<bool>("IsActive")
.HasColumnType("bit");
@@ -446,11 +437,8 @@ namespace Complex.Infrastructure.Migrations
modelBuilder.Entity("Complex.Domain.Entities.Province", b =>
{
b.Property<int>("ProvinceId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ProvinceId"), 1L, 1);
b.Property<string>("ProvinceTitle")
.HasColumnType("nvarchar(max)");
@@ -492,11 +480,8 @@ namespace Complex.Infrastructure.Migrations
modelBuilder.Entity("Complex.Domain.Entities.Transaction", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"), 1L, 1);
b.Property<long>("Amount")
.HasColumnType("bigint");
@@ -515,7 +500,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasDefaultValue(new DateTime(2026, 6, 9, 2, 21, 59, 648, DateTimeKind.Local).AddTicks(3522));
.HasDefaultValue(new DateTime(2026, 6, 9, 2, 28, 45, 625, DateTimeKind.Local).AddTicks(3921));
b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd()
@@ -586,7 +571,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasDefaultValue(new DateTime(2026, 6, 9, 2, 21, 59, 649, DateTimeKind.Local).AddTicks(412));
.HasDefaultValue(new DateTime(2026, 6, 9, 2, 28, 45, 625, DateTimeKind.Local).AddTicks(7151));
b.Property<bool>("IsActive")
.HasColumnType("bit");
@@ -657,7 +642,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasDefaultValue(new DateTime(2026, 6, 9, 2, 21, 59, 649, DateTimeKind.Local).AddTicks(6073));
.HasDefaultValue(new DateTime(2026, 6, 9, 2, 28, 45, 625, DateTimeKind.Local).AddTicks(9764));
b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd()
@@ -688,11 +673,8 @@ namespace Complex.Infrastructure.Migrations
modelBuilder.Entity("Complex.Domain.Entities.UnitState", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<Guid?>("ComplexId")
.HasColumnType("uniqueidentifier");
@@ -703,7 +685,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2")
.HasDefaultValue(new DateTime(2026, 6, 9, 2, 21, 59, 650, DateTimeKind.Local).AddTicks(161));
.HasDefaultValue(new DateTime(2026, 6, 9, 2, 28, 45, 626, DateTimeKind.Local).AddTicks(1646));
b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd()