Fix 'Invalid object name Provinces' error - reset migrations and switch to Migrate()

This commit is contained in:
2026-06-09 02:13:29 +03:30
parent 7a4190ca13
commit 569e39b58d
7 changed files with 740 additions and 174 deletions

View File

@@ -1,8 +1,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
namespace Complex.Domain.Entities namespace Complex.Domain.Entities
{ {
[Table("Cities")]
public partial class City public partial class City
{ {
public City() public City()

View File

@@ -1,8 +1,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
namespace Complex.Domain.Entities namespace Complex.Domain.Entities
{ {
[Table("Provinces")]
public partial class Province public partial class Province
{ {
public Province() public Province()

View File

@@ -123,6 +123,7 @@ builder.Services.AddDbContext<ComplexDBContext>(
); );
*/ */
builder.Services.AddApiVersioning(Options => builder.Services.AddApiVersioning(Options =>
{ {
Options.AssumeDefaultVersionWhenUnspecified = true; Options.AssumeDefaultVersionWhenUnspecified = true;
@@ -177,13 +178,39 @@ builder.Services.AddSwaggerGen(c =>
var app = builder.Build(); var app = builder.Build();
// Ensure database is created and apply pending migrations // Apply pending migrations and create database if not exists
using (var scope = app.Services.CreateScope()) using (var scope = app.Services.CreateScope())
{ {
var dbContext = scope.ServiceProvider.GetRequiredService<ComplexDBContext>(); var dbContext = scope.ServiceProvider.GetRequiredService<ComplexDBContext>();
// EnsureCreated creates all tables from the model if they don't exist,
// while Migrate applies any pending migrations on top. // If the database was previously created with EnsureCreated() (no __EFMigrationsHistory),
dbContext.Database.EnsureCreated(); // seed the history table so Migrate() knows the initial state
if (!dbContext.Database.GetAppliedMigrations().Any())
{
try
{
// Check if any tables exist (meaning EnsureCreated was used before)
var tableCount = dbContext.Database.ExecuteSqlRaw(
"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE'");
if (tableCount > 0)
{
// Create __EFMigrationsHistory if it doesn't exist and seed it
dbContext.Database.ExecuteSqlRaw(
"IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '__EFMigrationsHistory') " +
"BEGIN " +
"CREATE TABLE [__EFMigrationsHistory] ([MigrationId] nvarchar(150) NOT NULL, [ProductVersion] nvarchar(32) NOT NULL, PRIMARY KEY ([MigrationId])); " +
"END " +
"IF NOT EXISTS (SELECT * FROM __EFMigrationsHistory WHERE MigrationId = '20260608224155_InitialCreate') " +
"INSERT INTO __EFMigrationsHistory (MigrationId, ProductVersion) VALUES ('20260608224155_InitialCreate', '6.0.3')");
}
}
catch
{
// Database doesn't exist yet, Migrate() will create it
}
}
dbContext.Database.Migrate();
// Seed essential reference data and test data // Seed essential reference data and test data
await DataSeeder.SeedAsync(dbContext); await DataSeeder.SeedAsync(dbContext);
} }

View File

@@ -1,144 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Complex.Infrastructure.Migrations
{
public partial class addcomplexPerson : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ComplexPersons",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ComplexId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
PersonMobileNumberId = table.Column<string>(type: "nvarchar(450)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ComplexPersons", x => x.Id);
table.ForeignKey(
name: "FK_ComplexPersons_Persons_PersonMobileNumberId",
column: x => x.PersonMobileNumberId,
principalTable: "Persons",
principalColumn: "Id");
});
migrationBuilder.CreateIndex(
name: "IX_ComplexPersons_PersonMobileNumberId",
table: "ComplexPersons",
column: "PersonMobileNumberId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ComplexPersons");
migrationBuilder.AlterColumn<DateTime>(
name: "InsertTime",
table: "UnitStates",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(2025, 6, 1, 6, 15, 25, 234, DateTimeKind.Local).AddTicks(8929),
oldClrType: typeof(DateTime),
oldType: "datetime2",
oldDefaultValue: new DateTime(2025, 6, 1, 6, 17, 40, 44, DateTimeKind.Local).AddTicks(2122));
migrationBuilder.AlterColumn<DateTime>(
name: "InsertTime",
table: "Units",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(2025, 6, 1, 6, 15, 25, 234, DateTimeKind.Local).AddTicks(3769),
oldClrType: typeof(DateTime),
oldType: "datetime2",
oldDefaultValue: new DateTime(2025, 6, 1, 6, 17, 40, 43, DateTimeKind.Local).AddTicks(7020));
migrationBuilder.AlterColumn<DateTime>(
name: "InsertTime",
table: "UnitCosts",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(2025, 6, 1, 6, 15, 25, 234, DateTimeKind.Local).AddTicks(6906),
oldClrType: typeof(DateTime),
oldType: "datetime2",
oldDefaultValue: new DateTime(2025, 6, 1, 6, 17, 40, 44, DateTimeKind.Local).AddTicks(118));
migrationBuilder.AlterColumn<DateTime>(
name: "InsertTime",
table: "Transactions",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(2025, 6, 1, 6, 15, 25, 234, DateTimeKind.Local).AddTicks(717),
oldClrType: typeof(DateTime),
oldType: "datetime2",
oldDefaultValue: new DateTime(2025, 6, 1, 6, 17, 40, 43, DateTimeKind.Local).AddTicks(3798));
migrationBuilder.AlterColumn<DateTime>(
name: "InsertTime",
table: "Persons",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(2025, 6, 1, 6, 15, 25, 233, DateTimeKind.Local).AddTicks(7990),
oldClrType: typeof(DateTime),
oldType: "datetime2",
oldDefaultValue: new DateTime(2025, 6, 1, 6, 17, 40, 43, DateTimeKind.Local).AddTicks(1127));
migrationBuilder.AlterColumn<DateTime>(
name: "InsertTime",
table: "IncomeCostTitles",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(2025, 6, 1, 6, 15, 25, 233, DateTimeKind.Local).AddTicks(5558),
oldClrType: typeof(DateTime),
oldType: "datetime2",
oldDefaultValue: new DateTime(2025, 6, 1, 6, 17, 40, 42, DateTimeKind.Local).AddTicks(8706));
migrationBuilder.AlterColumn<DateTime>(
name: "InsertTime",
table: "CostCycles",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(2025, 6, 1, 6, 15, 25, 233, DateTimeKind.Local).AddTicks(2909),
oldClrType: typeof(DateTime),
oldType: "datetime2",
oldDefaultValue: new DateTime(2025, 6, 1, 6, 17, 40, 42, DateTimeKind.Local).AddTicks(6075));
migrationBuilder.AlterColumn<DateTime>(
name: "InsertTime",
table: "ComplexUnitEvents",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(2025, 6, 1, 6, 15, 25, 233, DateTimeKind.Local).AddTicks(1398),
oldClrType: typeof(DateTime),
oldType: "datetime2",
oldDefaultValue: new DateTime(2025, 6, 1, 6, 17, 40, 42, DateTimeKind.Local).AddTicks(4581));
migrationBuilder.AlterColumn<DateTime>(
name: "InsertTime",
table: "ComplexManagers",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(2025, 6, 1, 6, 15, 25, 232, DateTimeKind.Local).AddTicks(9811),
oldClrType: typeof(DateTime),
oldType: "datetime2",
oldDefaultValue: new DateTime(2025, 6, 1, 6, 17, 40, 42, DateTimeKind.Local).AddTicks(2979));
migrationBuilder.AlterColumn<DateTime>(
name: "InsertTime",
table: "ComplexEntities",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(2025, 6, 1, 6, 15, 25, 232, DateTimeKind.Local).AddTicks(6954),
oldClrType: typeof(DateTime),
oldType: "datetime2",
oldDefaultValue: new DateTime(2025, 6, 1, 6, 17, 40, 42, DateTimeKind.Local).AddTicks(207));
}
}
}

View File

@@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Complex.Infrastructure.Migrations namespace Complex.Infrastructure.Migrations
{ {
[DbContext(typeof(ComplexDBContext))] [DbContext(typeof(ComplexDBContext))]
[Migration("20250601024740_add-complexPerson")] [Migration("20260608224155_InitialCreate")]
partial class addcomplexPerson partial class InitialCreate
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
{ {
@@ -92,7 +92,7 @@ namespace Complex.Infrastructure.Migrations
b.HasIndex("ProvinceId"); b.HasIndex("ProvinceId");
b.ToTable("City"); b.ToTable("Cities");
}); });
modelBuilder.Entity("Complex.Domain.Entities.ComplexEntity", b => modelBuilder.Entity("Complex.Domain.Entities.ComplexEntity", b =>
@@ -119,7 +119,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .HasColumnType("datetime2")
.HasDefaultValue(new DateTime(2025, 6, 1, 6, 17, 40, 42, DateTimeKind.Local).AddTicks(207)); .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(350));
b.Property<bool>("IsRemoved") b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -178,7 +178,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .HasColumnType("datetime2")
.HasDefaultValue(new DateTime(2025, 6, 1, 6, 17, 40, 42, DateTimeKind.Local).AddTicks(2979)); .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(2221));
b.Property<bool>("IsRemoved") b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -254,7 +254,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .HasColumnType("datetime2")
.HasDefaultValue(new DateTime(2025, 6, 1, 6, 17, 40, 42, DateTimeKind.Local).AddTicks(4581)); .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(3082));
b.Property<bool>("IsRemoved") b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -306,7 +306,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .HasColumnType("datetime2")
.HasDefaultValue(new DateTime(2025, 6, 1, 6, 17, 40, 42, DateTimeKind.Local).AddTicks(6075)); .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(4033));
b.Property<bool>("IsRemoved") b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -349,7 +349,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .HasColumnType("datetime2")
.HasDefaultValue(new DateTime(2025, 6, 1, 6, 17, 40, 42, DateTimeKind.Local).AddTicks(8706)); .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(5727));
b.Property<bool>("IsRemoved") b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -397,7 +397,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .HasColumnType("datetime2")
.HasDefaultValue(new DateTime(2025, 6, 1, 6, 17, 40, 43, DateTimeKind.Local).AddTicks(1127)); .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(7277));
b.Property<bool>("IsActive") b.Property<bool>("IsActive")
.HasColumnType("bit"); .HasColumnType("bit");
@@ -458,7 +458,7 @@ namespace Complex.Infrastructure.Migrations
b.HasKey("ProvinceId"); b.HasKey("ProvinceId");
b.ToTable("Province"); b.ToTable("Provinces");
}); });
modelBuilder.Entity("Complex.Domain.Entities.SmsCode", b => modelBuilder.Entity("Complex.Domain.Entities.SmsCode", b =>
@@ -517,7 +517,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .HasColumnType("datetime2")
.HasDefaultValue(new DateTime(2025, 6, 1, 6, 17, 40, 43, DateTimeKind.Local).AddTicks(3798)); .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(9359));
b.Property<bool>("IsRemoved") b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -588,7 +588,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .HasColumnType("datetime2")
.HasDefaultValue(new DateTime(2025, 6, 1, 6, 17, 40, 43, DateTimeKind.Local).AddTicks(7020)); .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 154, DateTimeKind.Local).AddTicks(1589));
b.Property<bool>("IsActive") b.Property<bool>("IsActive")
.HasColumnType("bit"); .HasColumnType("bit");
@@ -659,7 +659,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .HasColumnType("datetime2")
.HasDefaultValue(new DateTime(2025, 6, 1, 6, 17, 40, 44, DateTimeKind.Local).AddTicks(118)); .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 154, DateTimeKind.Local).AddTicks(3756));
b.Property<bool>("IsRemoved") b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -705,7 +705,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .HasColumnType("datetime2")
.HasDefaultValue(new DateTime(2025, 6, 1, 6, 17, 40, 44, DateTimeKind.Local).AddTicks(2122)); .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 154, DateTimeKind.Local).AddTicks(4973));
b.Property<bool>("IsRemoved") b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()

View File

@@ -0,0 +1,679 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Complex.Infrastructure.Migrations
{
public partial class InitialCreate : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "BasicTables",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Title = table.Column<string>(type: "nvarchar(max)", nullable: false),
Discriminator = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_BasicTables", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Chats",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ComplexId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
PersonMobileNumber = table.Column<string>(type: "nvarchar(max)", nullable: false),
Body = table.Column<string>(type: "nvarchar(max)", nullable: false),
ChatTypeId = table.Column<byte>(type: "tinyint", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Chats", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ComplexUnitEvents",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
UnitId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
ComplexId = table.Column<int>(type: "int", nullable: true),
EventDate = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: false),
RegisterMobileNumber = 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),
InsertTime = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(3082)),
IsRemoved = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
RemoveTime = table.Column<DateTime>(type: "datetime2", nullable: true),
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ComplexUnitEvents", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Persons",
columns: table => new
{
Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
FirstName = table.Column<string>(type: "nvarchar(max)", nullable: true),
LastName = table.Column<string>(type: "nvarchar(max)", nullable: true),
Gender = table.Column<byte>(type: "tinyint", nullable: true),
Avatar = table.Column<byte[]>(type: "varbinary(max)", nullable: true),
IsActive = table.Column<bool>(type: "bit", nullable: false),
InsertTime = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(7277)),
IsRemoved = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
RemoveTime = table.Column<DateTime>(type: "datetime2", nullable: true),
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Persons", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Posters",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
RegisterMobileNumber = table.Column<string>(type: "nvarchar(max)", nullable: false),
IsActive = table.Column<bool>(type: "bit", nullable: false),
ImagePath = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Posters", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Provinces",
columns: table => new
{
ProvinceId = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ProvinceTitle = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Provinces", x => x.ProvinceId);
});
migrationBuilder.CreateTable(
name: "SmsCodes",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
PhoneNumber = table.Column<string>(type: "nvarchar(max)", nullable: false),
Code = table.Column<string>(type: "nvarchar(max)", nullable: false),
Used = table.Column<bool>(type: "bit", nullable: false),
RequestCount = table.Column<int>(type: "int", nullable: false),
InsertDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SmsCodes", x => x.Id);
});
migrationBuilder.CreateTable(
name: "UnitStates",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ComplexId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Title = 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, 11, 55, 154, DateTimeKind.Local).AddTicks(4973)),
IsRemoved = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
RemoveTime = table.Column<DateTime>(type: "datetime2", nullable: true),
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_UnitStates", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ComplexPersons",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ComplexId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
PersonMobileNumberId = table.Column<string>(type: "nvarchar(450)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ComplexPersons", x => x.Id);
table.ForeignKey(
name: "FK_ComplexPersons_Persons_PersonMobileNumberId",
column: x => x.PersonMobileNumberId,
principalTable: "Persons",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "UserTokens",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
TokenHash = table.Column<string>(type: "nvarchar(max)", nullable: false),
TokenExp = table.Column<DateTime>(type: "datetime2", nullable: false),
RefreshToken = table.Column<string>(type: "nvarchar(max)", nullable: false),
RefreshTokenExp = table.Column<DateTime>(type: "datetime2", nullable: false),
MobileModel = table.Column<string>(type: "nvarchar(max)", nullable: false),
PersonId = table.Column<string>(type: "nvarchar(450)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_UserTokens", x => x.Id);
table.ForeignKey(
name: "FK_UserTokens_Persons_PersonId",
column: x => x.PersonId,
principalTable: "Persons",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Cities",
columns: table => new
{
CityId = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ProvinceId = table.Column<int>(type: "int", nullable: true),
CityTitle = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Cities", x => x.CityId);
table.ForeignKey(
name: "FK_Cities_Provinces_ProvinceId",
column: x => x.ProvinceId,
principalTable: "Provinces",
principalColumn: "ProvinceId");
});
migrationBuilder.CreateTable(
name: "ComplexEntities",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Title = table.Column<string>(type: "nvarchar(max)", nullable: false),
Address = table.Column<string>(type: "nvarchar(max)", nullable: true),
StateId = table.Column<int>(type: "int", nullable: true),
AreaMeter = table.Column<int>(type: "int", nullable: true),
YardMeter = table.Column<int>(type: "int", nullable: true),
ElevatorCount = table.Column<int>(type: "int", nullable: true),
WarehouseCount = table.Column<int>(type: "int", nullable: true),
YearMake = table.Column<int>(type: "int", nullable: true),
ParentId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
CityId = table.Column<int>(type: "int", nullable: false),
InsertTime = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(350)),
IsRemoved = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
RemoveTime = table.Column<DateTime>(type: "datetime2", nullable: true),
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ComplexEntities", x => x.Id);
table.ForeignKey(
name: "FK_ComplexEntities_Cities_CityId",
column: x => x.CityId,
principalTable: "Cities",
principalColumn: "CityId",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ComplexEntities_ComplexEntities_ParentId",
column: x => x.ParentId,
principalTable: "ComplexEntities",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "ComplexManagers",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ComplexId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ManagerMobileNumberId = table.Column<string>(type: "nvarchar(450)", nullable: true),
StartDate = 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, 11, 55, 153, DateTimeKind.Local).AddTicks(2221)),
IsRemoved = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
RemoveTime = table.Column<DateTime>(type: "datetime2", nullable: true),
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ComplexManagers", x => x.Id);
table.ForeignKey(
name: "FK_ComplexManagers_ComplexEntities_ComplexId",
column: x => x.ComplexId,
principalTable: "ComplexEntities",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ComplexManagers_Persons_ManagerMobileNumberId",
column: x => x.ManagerMobileNumberId,
principalTable: "Persons",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "IncomeCostTitles",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Title = table.Column<string>(type: "nvarchar(max)", nullable: true),
TransactionTypeId = table.Column<int>(type: "int", nullable: false),
ComplexId = table.Column<Guid>(type: "uniqueidentifier", 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, 11, 55, 153, DateTimeKind.Local).AddTicks(5727)),
IsRemoved = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
RemoveTime = table.Column<DateTime>(type: "datetime2", nullable: true),
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_IncomeCostTitles", x => x.Id);
table.ForeignKey(
name: "FK_IncomeCostTitles_BasicTables_TransactionTypeId",
column: x => x.TransactionTypeId,
principalTable: "BasicTables",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_IncomeCostTitles_ComplexEntities_ComplexId",
column: x => x.ComplexId,
principalTable: "ComplexEntities",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "Units",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ComplexId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
UnitName = table.Column<string>(type: "nvarchar(max)", nullable: false),
OwnerId = table.Column<string>(type: "nvarchar(450)", nullable: true),
TenantId = table.Column<string>(type: "nvarchar(450)", nullable: true),
IsActive = table.Column<bool>(type: "bit", nullable: false),
AreaMeter = table.Column<int>(type: "int", nullable: true),
EmergencyTels = table.Column<string>(type: "nvarchar(max)", nullable: true),
ParkingAreaMeter = table.Column<int>(type: "int", nullable: true),
YardMeter = table.Column<int>(type: "int", nullable: true),
PublicState = table.Column<string>(type: "nvarchar(max)", nullable: true),
StateId = table.Column<int>(type: "int", nullable: true),
Floor = table.Column<int>(type: "int", 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, 11, 55, 154, DateTimeKind.Local).AddTicks(1589)),
IsRemoved = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
RemoveTime = table.Column<DateTime>(type: "datetime2", nullable: true),
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Units", x => x.Id);
table.ForeignKey(
name: "FK_Units_ComplexEntities_ComplexId",
column: x => x.ComplexId,
principalTable: "ComplexEntities",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Units_Persons_OwnerId",
column: x => x.OwnerId,
principalTable: "Persons",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Units_Persons_TenantId",
column: x => x.TenantId,
principalTable: "Persons",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Units_UnitStates_StateId",
column: x => x.StateId,
principalTable: "UnitStates",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "CostCycles",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ComplexId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Title = table.Column<string>(type: "nvarchar(max)", nullable: false),
StartDate = table.Column<DateTime>(type: "date", nullable: false),
EndDate = table.Column<DateTime>(type: "date", nullable: false),
Amount = table.Column<long>(type: "bigint", nullable: false),
EncouragementDay = table.Column<int>(type: "int", nullable: false),
EncouragementAmount = table.Column<long>(type: "bigint", nullable: false),
IncomeCostTitleId = table.Column<int>(type: "int", nullable: true),
InsertTime = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(4033)),
IsRemoved = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
RemoveTime = table.Column<DateTime>(type: "datetime2", nullable: true),
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CostCycles", x => x.Id);
table.ForeignKey(
name: "FK_CostCycles_ComplexEntities_ComplexId",
column: x => x.ComplexId,
principalTable: "ComplexEntities",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_CostCycles_IncomeCostTitles_IncomeCostTitleId",
column: x => x.IncomeCostTitleId,
principalTable: "IncomeCostTitles",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "CostCycleUnit",
columns: table => new
{
CostCyclesId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
UnitsId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CostCycleUnit", x => new { x.CostCyclesId, x.UnitsId });
table.ForeignKey(
name: "FK_CostCycleUnit_CostCycles_CostCyclesId",
column: x => x.CostCyclesId,
principalTable: "CostCycles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_CostCycleUnit_Units_UnitsId",
column: x => x.UnitsId,
principalTable: "Units",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "UnitCosts",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
CostCycleId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
UnitId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TransactionId = table.Column<int>(type: "int", nullable: true),
Date = table.Column<DateTime>(type: "date", nullable: false),
InsertTime = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 11, 55, 154, DateTimeKind.Local).AddTicks(3756)),
IsRemoved = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
RemoveTime = table.Column<DateTime>(type: "datetime2", nullable: true),
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_UnitCosts", x => x.Id);
table.ForeignKey(
name: "FK_UnitCosts_CostCycles_CostCycleId",
column: x => x.CostCycleId,
principalTable: "CostCycles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_UnitCosts_Units_UnitId",
column: x => x.UnitId,
principalTable: "Units",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Transactions",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
TransactionTitleId = table.Column<int>(type: "int", nullable: true),
TransactionPersianDate = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: false),
TransactionDate = table.Column<DateTime>(type: "datetime2", nullable: false),
Amount = table.Column<long>(type: "bigint", nullable: false),
Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
CostCycleId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
UnitId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
FicheId = table.Column<string>(type: "nvarchar(max)", nullable: true),
ComplexId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
UnitCostId = table.Column<long>(type: "bigint", 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, 11, 55, 153, DateTimeKind.Local).AddTicks(9359)),
IsRemoved = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
RemoveTime = table.Column<DateTime>(type: "datetime2", nullable: true),
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Transactions", x => x.Id);
table.ForeignKey(
name: "FK_Transactions_CostCycles_CostCycleId",
column: x => x.CostCycleId,
principalTable: "CostCycles",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Transactions_IncomeCostTitles_TransactionTitleId",
column: x => x.TransactionTitleId,
principalTable: "IncomeCostTitles",
principalColumn: "Id");
table.ForeignKey(
name: "FK_Transactions_Persons_PersonId",
column: x => x.PersonId,
principalTable: "Persons",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Transactions_UnitCosts_UnitCostId",
column: x => x.UnitCostId,
principalTable: "UnitCosts",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Transactions_Units_UnitId",
column: x => x.UnitId,
principalTable: "Units",
principalColumn: "Id");
});
migrationBuilder.CreateIndex(
name: "IX_Cities_ProvinceId",
table: "Cities",
column: "ProvinceId");
migrationBuilder.CreateIndex(
name: "IX_ComplexEntities_CityId",
table: "ComplexEntities",
column: "CityId");
migrationBuilder.CreateIndex(
name: "IX_ComplexEntities_ParentId",
table: "ComplexEntities",
column: "ParentId");
migrationBuilder.CreateIndex(
name: "IX_ComplexManagers_ComplexId",
table: "ComplexManagers",
column: "ComplexId");
migrationBuilder.CreateIndex(
name: "IX_ComplexManagers_ManagerMobileNumberId",
table: "ComplexManagers",
column: "ManagerMobileNumberId");
migrationBuilder.CreateIndex(
name: "IX_ComplexPersons_PersonMobileNumberId",
table: "ComplexPersons",
column: "PersonMobileNumberId");
migrationBuilder.CreateIndex(
name: "IX_CostCycles_ComplexId",
table: "CostCycles",
column: "ComplexId");
migrationBuilder.CreateIndex(
name: "IX_CostCycles_IncomeCostTitleId",
table: "CostCycles",
column: "IncomeCostTitleId");
migrationBuilder.CreateIndex(
name: "IX_CostCycleUnit_UnitsId",
table: "CostCycleUnit",
column: "UnitsId");
migrationBuilder.CreateIndex(
name: "IX_IncomeCostTitles_ComplexId",
table: "IncomeCostTitles",
column: "ComplexId");
migrationBuilder.CreateIndex(
name: "IX_IncomeCostTitles_TransactionTypeId",
table: "IncomeCostTitles",
column: "TransactionTypeId");
migrationBuilder.CreateIndex(
name: "IX_Transactions_CostCycleId",
table: "Transactions",
column: "CostCycleId");
migrationBuilder.CreateIndex(
name: "IX_Transactions_PersonId",
table: "Transactions",
column: "PersonId");
migrationBuilder.CreateIndex(
name: "IX_Transactions_TransactionTitleId",
table: "Transactions",
column: "TransactionTitleId");
migrationBuilder.CreateIndex(
name: "IX_Transactions_UnitCostId",
table: "Transactions",
column: "UnitCostId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Transactions_UnitId",
table: "Transactions",
column: "UnitId");
migrationBuilder.CreateIndex(
name: "IX_UnitCosts_CostCycleId",
table: "UnitCosts",
column: "CostCycleId");
migrationBuilder.CreateIndex(
name: "IX_UnitCosts_UnitId",
table: "UnitCosts",
column: "UnitId");
migrationBuilder.CreateIndex(
name: "IX_Units_ComplexId",
table: "Units",
column: "ComplexId");
migrationBuilder.CreateIndex(
name: "IX_Units_OwnerId",
table: "Units",
column: "OwnerId");
migrationBuilder.CreateIndex(
name: "IX_Units_StateId",
table: "Units",
column: "StateId");
migrationBuilder.CreateIndex(
name: "IX_Units_TenantId",
table: "Units",
column: "TenantId");
migrationBuilder.CreateIndex(
name: "IX_UserTokens_PersonId",
table: "UserTokens",
column: "PersonId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Chats");
migrationBuilder.DropTable(
name: "ComplexManagers");
migrationBuilder.DropTable(
name: "ComplexPersons");
migrationBuilder.DropTable(
name: "ComplexUnitEvents");
migrationBuilder.DropTable(
name: "CostCycleUnit");
migrationBuilder.DropTable(
name: "Posters");
migrationBuilder.DropTable(
name: "SmsCodes");
migrationBuilder.DropTable(
name: "Transactions");
migrationBuilder.DropTable(
name: "UserTokens");
migrationBuilder.DropTable(
name: "UnitCosts");
migrationBuilder.DropTable(
name: "CostCycles");
migrationBuilder.DropTable(
name: "Units");
migrationBuilder.DropTable(
name: "IncomeCostTitles");
migrationBuilder.DropTable(
name: "Persons");
migrationBuilder.DropTable(
name: "UnitStates");
migrationBuilder.DropTable(
name: "BasicTables");
migrationBuilder.DropTable(
name: "ComplexEntities");
migrationBuilder.DropTable(
name: "Cities");
migrationBuilder.DropTable(
name: "Provinces");
}
}
}

View File

@@ -90,7 +90,7 @@ namespace Complex.Infrastructure.Migrations
b.HasIndex("ProvinceId"); b.HasIndex("ProvinceId");
b.ToTable("City"); b.ToTable("Cities");
}); });
modelBuilder.Entity("Complex.Domain.Entities.ComplexEntity", b => modelBuilder.Entity("Complex.Domain.Entities.ComplexEntity", b =>
@@ -117,7 +117,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .HasColumnType("datetime2")
.HasDefaultValue(new DateTime(2025, 6, 1, 6, 17, 40, 42, DateTimeKind.Local).AddTicks(207)); .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(350));
b.Property<bool>("IsRemoved") b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -176,7 +176,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .HasColumnType("datetime2")
.HasDefaultValue(new DateTime(2025, 6, 1, 6, 17, 40, 42, DateTimeKind.Local).AddTicks(2979)); .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(2221));
b.Property<bool>("IsRemoved") b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -252,7 +252,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .HasColumnType("datetime2")
.HasDefaultValue(new DateTime(2025, 6, 1, 6, 17, 40, 42, DateTimeKind.Local).AddTicks(4581)); .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(3082));
b.Property<bool>("IsRemoved") b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -304,7 +304,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .HasColumnType("datetime2")
.HasDefaultValue(new DateTime(2025, 6, 1, 6, 17, 40, 42, DateTimeKind.Local).AddTicks(6075)); .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(4033));
b.Property<bool>("IsRemoved") b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -347,7 +347,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .HasColumnType("datetime2")
.HasDefaultValue(new DateTime(2025, 6, 1, 6, 17, 40, 42, DateTimeKind.Local).AddTicks(8706)); .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(5727));
b.Property<bool>("IsRemoved") b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -395,7 +395,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .HasColumnType("datetime2")
.HasDefaultValue(new DateTime(2025, 6, 1, 6, 17, 40, 43, DateTimeKind.Local).AddTicks(1127)); .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(7277));
b.Property<bool>("IsActive") b.Property<bool>("IsActive")
.HasColumnType("bit"); .HasColumnType("bit");
@@ -456,7 +456,7 @@ namespace Complex.Infrastructure.Migrations
b.HasKey("ProvinceId"); b.HasKey("ProvinceId");
b.ToTable("Province"); b.ToTable("Provinces");
}); });
modelBuilder.Entity("Complex.Domain.Entities.SmsCode", b => modelBuilder.Entity("Complex.Domain.Entities.SmsCode", b =>
@@ -515,7 +515,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .HasColumnType("datetime2")
.HasDefaultValue(new DateTime(2025, 6, 1, 6, 17, 40, 43, DateTimeKind.Local).AddTicks(3798)); .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(9359));
b.Property<bool>("IsRemoved") b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -586,7 +586,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .HasColumnType("datetime2")
.HasDefaultValue(new DateTime(2025, 6, 1, 6, 17, 40, 43, DateTimeKind.Local).AddTicks(7020)); .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 154, DateTimeKind.Local).AddTicks(1589));
b.Property<bool>("IsActive") b.Property<bool>("IsActive")
.HasColumnType("bit"); .HasColumnType("bit");
@@ -657,7 +657,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .HasColumnType("datetime2")
.HasDefaultValue(new DateTime(2025, 6, 1, 6, 17, 40, 44, DateTimeKind.Local).AddTicks(118)); .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 154, DateTimeKind.Local).AddTicks(3756));
b.Property<bool>("IsRemoved") b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@@ -703,7 +703,7 @@ namespace Complex.Infrastructure.Migrations
b.Property<DateTime>("InsertTime") b.Property<DateTime>("InsertTime")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("datetime2") .HasColumnType("datetime2")
.HasDefaultValue(new DateTime(2025, 6, 1, 6, 17, 40, 44, DateTimeKind.Local).AddTicks(2122)); .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 154, DateTimeKind.Local).AddTicks(4973));
b.Property<bool>("IsRemoved") b.Property<bool>("IsRemoved")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()