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

@@ -77,6 +77,43 @@ namespace Complex.Infrastructure
.WithMany() .WithMany()
.HasForeignKey(uc => uc.UnitId) .HasForeignKey(uc => uc.UnitId)
.OnDelete(DeleteBehavior.NoAction); .OnDelete(DeleteBehavior.NoAction);
// ============================================================
// Reference/Lookup tables: These have fixed, meaningful IDs
// that are explicitly set in seed data and cross-referenced
// by other entities. Identity auto-generation must be disabled.
// ============================================================
// Province: ProvinceId (1-31) are stable identifiers
builder.Entity<Province>()
.Property(p => p.ProvinceId)
.ValueGeneratedNever();
// City: CityId (101, 102, ...) are meaningful (provinceId * 100 + index)
builder.Entity<City>()
.Property(c => c.CityId)
.ValueGeneratedNever();
// BasicTable (base for TransactionType): Id (1,2) are fixed reference data
builder.Entity<BasicTable>()
.Property(b => b.Id)
.ValueGeneratedNever();
// IncomeCostTitle: Id (1-12) are fixed reference data
builder.Entity<IncomeCostTitle>()
.Property(i => i.Id)
.ValueGeneratedNever();
// UnitState: Id (1-5) are fixed reference data
builder.Entity<UnitState>()
.Property(u => u.Id)
.ValueGeneratedNever();
// Transaction: Seeder uses explicit IDs (1,2,3) that are
// cross-referenced by UnitCost.TransactionId
builder.Entity<Transaction>()
.Property(t => t.Id)
.ValueGeneratedNever();
} }

View File

@@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Complex.Infrastructure.Migrations namespace Complex.Infrastructure.Migrations
{ {
[DbContext(typeof(ComplexDBContext))] [DbContext(typeof(ComplexDBContext))]
[Migration("20260608225159_InitialCreate")] [Migration("20260608225845_InitialCreate")]
partial class InitialCreate partial class InitialCreate
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
@@ -27,11 +27,8 @@ namespace Complex.Infrastructure.Migrations
modelBuilder.Entity("Complex.Domain.Entities.BasicTable", b => modelBuilder.Entity("Complex.Domain.Entities.BasicTable", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<string>("Discriminator") b.Property<string>("Discriminator")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
@@ -77,11 +74,8 @@ namespace Complex.Infrastructure.Migrations
modelBuilder.Entity("Complex.Domain.Entities.City", b => modelBuilder.Entity("Complex.Domain.Entities.City", b =>
{ {
b.Property<int>("CityId") b.Property<int>("CityId")
.ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("CityId"), 1L, 1);
b.Property<string>("CityTitle") b.Property<string>("CityTitle")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
@@ -119,7 +113,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .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") b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -178,7 +172,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .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") b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -254,7 +248,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .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") b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -306,7 +300,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .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") b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -338,18 +332,15 @@ namespace Complex.Infrastructure.Migrations
modelBuilder.Entity("Complex.Domain.Entities.IncomeCostTitle", b => modelBuilder.Entity("Complex.Domain.Entities.IncomeCostTitle", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<Guid?>("ComplexId") b.Property<Guid?>("ComplexId")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .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") b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -397,7 +388,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .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") b.Property<bool>("IsActive")
.HasColumnType("bit"); .HasColumnType("bit");
@@ -448,11 +439,8 @@ namespace Complex.Infrastructure.Migrations
modelBuilder.Entity("Complex.Domain.Entities.Province", b => modelBuilder.Entity("Complex.Domain.Entities.Province", b =>
{ {
b.Property<int>("ProvinceId") b.Property<int>("ProvinceId")
.ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ProvinceId"), 1L, 1);
b.Property<string>("ProvinceTitle") b.Property<string>("ProvinceTitle")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
@@ -494,11 +482,8 @@ namespace Complex.Infrastructure.Migrations
modelBuilder.Entity("Complex.Domain.Entities.Transaction", b => modelBuilder.Entity("Complex.Domain.Entities.Transaction", b =>
{ {
b.Property<long>("Id") b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint"); .HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"), 1L, 1);
b.Property<long>("Amount") b.Property<long>("Amount")
.HasColumnType("bigint"); .HasColumnType("bigint");
@@ -517,7 +502,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .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") b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -588,7 +573,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .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") b.Property<bool>("IsActive")
.HasColumnType("bit"); .HasColumnType("bit");
@@ -659,7 +644,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .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") b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -690,11 +675,8 @@ namespace Complex.Infrastructure.Migrations
modelBuilder.Entity("Complex.Domain.Entities.UnitState", b => modelBuilder.Entity("Complex.Domain.Entities.UnitState", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<Guid?>("ComplexId") b.Property<Guid?>("ComplexId")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
@@ -705,7 +687,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .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") b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()

View File

@@ -13,8 +13,7 @@ namespace Complex.Infrastructure.Migrations
name: "BasicTables", name: "BasicTables",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(type: "int", nullable: false),
.Annotation("SqlServer:Identity", "1, 1"),
Title = table.Column<string>(type: "nvarchar(max)", nullable: false), Title = table.Column<string>(type: "nvarchar(max)", nullable: false),
Discriminator = table.Column<string>(type: "nvarchar(max)", nullable: false) Discriminator = table.Column<string>(type: "nvarchar(max)", nullable: false)
}, },
@@ -51,7 +50,7 @@ namespace Complex.Infrastructure.Migrations
RegisterMobileNumber = table.Column<string>(type: "nvarchar(max)", nullable: false), RegisterMobileNumber = table.Column<string>(type: "nvarchar(max)", nullable: false),
Body = table.Column<string>(type: "nvarchar(max)", nullable: false), Body = table.Column<string>(type: "nvarchar(max)", nullable: false),
Description = table.Column<string>(type: "nvarchar(max)", nullable: true), Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
InsertTime = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 21, 59, 646, DateTimeKind.Local).AddTicks(4981)), InsertTime = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 28, 45, 624, DateTimeKind.Local).AddTicks(5016)),
IsRemoved = table.Column<bool>(type: "bit", nullable: false, defaultValue: false), IsRemoved = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
RemoveTime = table.Column<DateTime>(type: "datetime2", nullable: true), RemoveTime = table.Column<DateTime>(type: "datetime2", nullable: true),
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true) UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true)
@@ -71,7 +70,7 @@ namespace Complex.Infrastructure.Migrations
Gender = table.Column<byte>(type: "tinyint", nullable: true), Gender = table.Column<byte>(type: "tinyint", nullable: true),
Avatar = table.Column<byte[]>(type: "varbinary(max)", nullable: true), Avatar = table.Column<byte[]>(type: "varbinary(max)", nullable: true),
IsActive = table.Column<bool>(type: "bit", nullable: false), IsActive = table.Column<bool>(type: "bit", nullable: false),
InsertTime = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 21, 59, 647, DateTimeKind.Local).AddTicks(86)), InsertTime = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 28, 45, 625, DateTimeKind.Local).AddTicks(1728)),
IsRemoved = table.Column<bool>(type: "bit", nullable: false, defaultValue: false), IsRemoved = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
RemoveTime = table.Column<DateTime>(type: "datetime2", nullable: true), RemoveTime = table.Column<DateTime>(type: "datetime2", nullable: true),
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true) UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true)
@@ -100,8 +99,7 @@ namespace Complex.Infrastructure.Migrations
name: "Provinces", name: "Provinces",
columns: table => new columns: table => new
{ {
ProvinceId = table.Column<int>(type: "int", nullable: false) ProvinceId = table.Column<int>(type: "int", nullable: false),
.Annotation("SqlServer:Identity", "1, 1"),
ProvinceTitle = table.Column<string>(type: "nvarchar(max)", nullable: true) ProvinceTitle = table.Column<string>(type: "nvarchar(max)", nullable: true)
}, },
constraints: table => constraints: table =>
@@ -130,12 +128,11 @@ namespace Complex.Infrastructure.Migrations
name: "UnitStates", name: "UnitStates",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(type: "int", nullable: false),
.Annotation("SqlServer:Identity", "1, 1"),
ComplexId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), ComplexId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Title = table.Column<string>(type: "nvarchar(max)", nullable: false), Title = table.Column<string>(type: "nvarchar(max)", nullable: false),
Icon = table.Column<string>(type: "nvarchar(max)", nullable: false), Icon = table.Column<string>(type: "nvarchar(max)", nullable: false),
InsertTime = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 21, 59, 650, DateTimeKind.Local).AddTicks(161)), InsertTime = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 28, 45, 626, DateTimeKind.Local).AddTicks(1646)),
IsRemoved = table.Column<bool>(type: "bit", nullable: false, defaultValue: false), IsRemoved = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
RemoveTime = table.Column<DateTime>(type: "datetime2", nullable: true), RemoveTime = table.Column<DateTime>(type: "datetime2", nullable: true),
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true) UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true)
@@ -192,8 +189,7 @@ namespace Complex.Infrastructure.Migrations
name: "Cities", name: "Cities",
columns: table => new columns: table => new
{ {
CityId = table.Column<int>(type: "int", nullable: false) CityId = table.Column<int>(type: "int", nullable: false),
.Annotation("SqlServer:Identity", "1, 1"),
ProvinceId = table.Column<int>(type: "int", nullable: true), ProvinceId = table.Column<int>(type: "int", nullable: true),
CityTitle = table.Column<string>(type: "nvarchar(max)", nullable: true) CityTitle = table.Column<string>(type: "nvarchar(max)", nullable: true)
}, },
@@ -223,7 +219,7 @@ namespace Complex.Infrastructure.Migrations
ParentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), ParentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Description = table.Column<string>(type: "nvarchar(max)", nullable: true), Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
CityId = table.Column<int>(type: "int", nullable: false), CityId = table.Column<int>(type: "int", nullable: false),
InsertTime = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 21, 59, 646, DateTimeKind.Local).AddTicks(1882)), InsertTime = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 28, 45, 623, DateTimeKind.Local).AddTicks(7632)),
IsRemoved = table.Column<bool>(type: "bit", nullable: false, defaultValue: false), IsRemoved = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
RemoveTime = table.Column<DateTime>(type: "datetime2", nullable: true), RemoveTime = table.Column<DateTime>(type: "datetime2", nullable: true),
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true) UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true)
@@ -254,7 +250,7 @@ namespace Complex.Infrastructure.Migrations
ManagerMobileNumberId = table.Column<string>(type: "nvarchar(450)", nullable: true), ManagerMobileNumberId = table.Column<string>(type: "nvarchar(450)", nullable: true),
StartDate = table.Column<string>(type: "nvarchar(max)", nullable: false), StartDate = table.Column<string>(type: "nvarchar(max)", nullable: false),
EndDate = table.Column<string>(type: "nvarchar(max)", nullable: false), EndDate = table.Column<string>(type: "nvarchar(max)", nullable: false),
InsertTime = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 21, 59, 646, DateTimeKind.Local).AddTicks(3884)), InsertTime = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 28, 45, 624, DateTimeKind.Local).AddTicks(2426)),
IsRemoved = table.Column<bool>(type: "bit", nullable: false, defaultValue: false), IsRemoved = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
RemoveTime = table.Column<DateTime>(type: "datetime2", nullable: true), RemoveTime = table.Column<DateTime>(type: "datetime2", nullable: true),
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true) UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true)
@@ -279,13 +275,12 @@ namespace Complex.Infrastructure.Migrations
name: "IncomeCostTitles", name: "IncomeCostTitles",
columns: table => new columns: table => new
{ {
Id = table.Column<int>(type: "int", nullable: false) Id = table.Column<int>(type: "int", nullable: false),
.Annotation("SqlServer:Identity", "1, 1"),
Title = table.Column<string>(type: "nvarchar(max)", nullable: true), Title = table.Column<string>(type: "nvarchar(max)", nullable: true),
TransactionTypeId = table.Column<int>(type: "int", nullable: false), TransactionTypeId = table.Column<int>(type: "int", nullable: false),
ComplexId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), ComplexId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
RegisterMobileNumber = table.Column<string>(type: "nvarchar(max)", nullable: true), RegisterMobileNumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
InsertTime = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 21, 59, 646, DateTimeKind.Local).AddTicks(8225)), InsertTime = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 28, 45, 624, DateTimeKind.Local).AddTicks(9858)),
IsRemoved = table.Column<bool>(type: "bit", nullable: false, defaultValue: false), IsRemoved = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
RemoveTime = table.Column<DateTime>(type: "datetime2", nullable: true), RemoveTime = table.Column<DateTime>(type: "datetime2", nullable: true),
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true) UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true)
@@ -324,7 +319,7 @@ namespace Complex.Infrastructure.Migrations
StateId = table.Column<int>(type: "int", nullable: true), StateId = table.Column<int>(type: "int", nullable: true),
Floor = table.Column<int>(type: "int", nullable: true), Floor = table.Column<int>(type: "int", nullable: true),
ManagerDescription = table.Column<string>(type: "nvarchar(max)", nullable: true), ManagerDescription = table.Column<string>(type: "nvarchar(max)", nullable: true),
InsertTime = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 21, 59, 649, DateTimeKind.Local).AddTicks(412)), InsertTime = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 28, 45, 625, DateTimeKind.Local).AddTicks(7151)),
IsRemoved = table.Column<bool>(type: "bit", nullable: false, defaultValue: false), IsRemoved = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
RemoveTime = table.Column<DateTime>(type: "datetime2", nullable: true), RemoveTime = table.Column<DateTime>(type: "datetime2", nullable: true),
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true) UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true)
@@ -368,7 +363,7 @@ namespace Complex.Infrastructure.Migrations
EncouragementDay = table.Column<int>(type: "int", nullable: false), EncouragementDay = table.Column<int>(type: "int", nullable: false),
EncouragementAmount = table.Column<long>(type: "bigint", nullable: false), EncouragementAmount = table.Column<long>(type: "bigint", nullable: false),
IncomeCostTitleId = table.Column<int>(type: "int", nullable: true), IncomeCostTitleId = table.Column<int>(type: "int", nullable: true),
InsertTime = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 21, 59, 646, DateTimeKind.Local).AddTicks(6348)), InsertTime = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 28, 45, 624, DateTimeKind.Local).AddTicks(7249)),
IsRemoved = table.Column<bool>(type: "bit", nullable: false, defaultValue: false), IsRemoved = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
RemoveTime = table.Column<DateTime>(type: "datetime2", nullable: true), RemoveTime = table.Column<DateTime>(type: "datetime2", nullable: true),
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true) UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true)
@@ -422,7 +417,7 @@ namespace Complex.Infrastructure.Migrations
UnitId = table.Column<Guid>(type: "uniqueidentifier", nullable: false), UnitId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TransactionId = table.Column<int>(type: "int", nullable: true), TransactionId = table.Column<int>(type: "int", nullable: true),
Date = table.Column<DateTime>(type: "date", nullable: false), Date = table.Column<DateTime>(type: "date", nullable: false),
InsertTime = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 21, 59, 649, DateTimeKind.Local).AddTicks(6073)), InsertTime = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 28, 45, 625, DateTimeKind.Local).AddTicks(9764)),
IsRemoved = table.Column<bool>(type: "bit", nullable: false, defaultValue: false), IsRemoved = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
RemoveTime = table.Column<DateTime>(type: "datetime2", nullable: true), RemoveTime = table.Column<DateTime>(type: "datetime2", nullable: true),
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true) UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true)
@@ -447,8 +442,7 @@ namespace Complex.Infrastructure.Migrations
name: "Transactions", name: "Transactions",
columns: table => new columns: table => new
{ {
Id = table.Column<long>(type: "bigint", nullable: false) Id = table.Column<long>(type: "bigint", nullable: false),
.Annotation("SqlServer:Identity", "1, 1"),
TransactionTitleId = table.Column<int>(type: "int", nullable: true), TransactionTitleId = table.Column<int>(type: "int", nullable: true),
TransactionPersianDate = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: false), TransactionPersianDate = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: false),
TransactionDate = table.Column<DateTime>(type: "datetime2", nullable: false), TransactionDate = table.Column<DateTime>(type: "datetime2", nullable: false),
@@ -460,7 +454,7 @@ namespace Complex.Infrastructure.Migrations
ComplexId = table.Column<Guid>(type: "uniqueidentifier", nullable: false), ComplexId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
UnitCostId = table.Column<long>(type: "bigint", nullable: false), UnitCostId = table.Column<long>(type: "bigint", nullable: false),
PersonId = table.Column<string>(type: "nvarchar(450)", nullable: false), PersonId = table.Column<string>(type: "nvarchar(450)", nullable: false),
InsertTime = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 21, 59, 648, DateTimeKind.Local).AddTicks(3522)), InsertTime = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 28, 45, 625, DateTimeKind.Local).AddTicks(3921)),
IsRemoved = table.Column<bool>(type: "bit", nullable: false, defaultValue: false), IsRemoved = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
RemoveTime = table.Column<DateTime>(type: "datetime2", nullable: true), RemoveTime = table.Column<DateTime>(type: "datetime2", nullable: true),
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true) UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true)

View File

@@ -25,11 +25,8 @@ namespace Complex.Infrastructure.Migrations
modelBuilder.Entity("Complex.Domain.Entities.BasicTable", b => modelBuilder.Entity("Complex.Domain.Entities.BasicTable", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<string>("Discriminator") b.Property<string>("Discriminator")
.IsRequired() .IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
@@ -75,11 +72,8 @@ namespace Complex.Infrastructure.Migrations
modelBuilder.Entity("Complex.Domain.Entities.City", b => modelBuilder.Entity("Complex.Domain.Entities.City", b =>
{ {
b.Property<int>("CityId") b.Property<int>("CityId")
.ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("CityId"), 1L, 1);
b.Property<string>("CityTitle") b.Property<string>("CityTitle")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
@@ -117,7 +111,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .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") b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -176,7 +170,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .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") b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -252,7 +246,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .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") b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -304,7 +298,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .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") b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -336,18 +330,15 @@ namespace Complex.Infrastructure.Migrations
modelBuilder.Entity("Complex.Domain.Entities.IncomeCostTitle", b => modelBuilder.Entity("Complex.Domain.Entities.IncomeCostTitle", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<Guid?>("ComplexId") b.Property<Guid?>("ComplexId")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .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") b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -395,7 +386,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .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") b.Property<bool>("IsActive")
.HasColumnType("bit"); .HasColumnType("bit");
@@ -446,11 +437,8 @@ namespace Complex.Infrastructure.Migrations
modelBuilder.Entity("Complex.Domain.Entities.Province", b => modelBuilder.Entity("Complex.Domain.Entities.Province", b =>
{ {
b.Property<int>("ProvinceId") b.Property<int>("ProvinceId")
.ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ProvinceId"), 1L, 1);
b.Property<string>("ProvinceTitle") b.Property<string>("ProvinceTitle")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
@@ -492,11 +480,8 @@ namespace Complex.Infrastructure.Migrations
modelBuilder.Entity("Complex.Domain.Entities.Transaction", b => modelBuilder.Entity("Complex.Domain.Entities.Transaction", b =>
{ {
b.Property<long>("Id") b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint"); .HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"), 1L, 1);
b.Property<long>("Amount") b.Property<long>("Amount")
.HasColumnType("bigint"); .HasColumnType("bigint");
@@ -515,7 +500,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .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") b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -586,7 +571,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .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") b.Property<bool>("IsActive")
.HasColumnType("bit"); .HasColumnType("bit");
@@ -657,7 +642,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .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") b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -688,11 +673,8 @@ namespace Complex.Infrastructure.Migrations
modelBuilder.Entity("Complex.Domain.Entities.UnitState", b => modelBuilder.Entity("Complex.Domain.Entities.UnitState", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int"); .HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<Guid?>("ComplexId") b.Property<Guid?>("ComplexId")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
@@ -703,7 +685,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .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") b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()