diff --git a/src/Domain/TakeoutSaaS.Domain/Identity/Entities/IdentityUser.cs b/src/Domain/TakeoutSaaS.Domain/Identity/Entities/IdentityUser.cs
index 65cc8c6..600d32d 100644
--- a/src/Domain/TakeoutSaaS.Domain/Identity/Entities/IdentityUser.cs
+++ b/src/Domain/TakeoutSaaS.Domain/Identity/Entities/IdentityUser.cs
@@ -79,7 +79,7 @@ public sealed class IdentityUser : AuditableEntityBase
public string? Avatar { get; set; }
///
- /// 并发控制字段(映射到 PostgreSQL xmin)。
+ /// 并发控制字段(映射到 PostgreSQL xmin 系统列)。
///
public uint RowVersion { get; set; }
}
diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/IdentityDb/20260205131209_SyncIdentityModel.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/IdentityDb/20260205131209_SyncIdentityModel.cs
deleted file mode 100644
index 79c614f..0000000
--- a/src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/IdentityDb/20260205131209_SyncIdentityModel.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-using Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-namespace TakeoutSaaS.Infrastructure.Migrations.IdentityDb
-{
- ///
- public partial class SyncIdentityModel : Migration
- {
- ///
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.RenameColumn(
- name: "RowVersion",
- table: "identity_users",
- newName: "xmin");
-
- migrationBuilder.AlterColumn(
- name: "xmin",
- table: "identity_users",
- type: "xid",
- rowVersion: true,
- nullable: false,
- comment: "并发控制字段(映射到 PostgreSQL xmin)。",
- oldClrType: typeof(byte[]),
- oldType: "bytea",
- oldRowVersion: true,
- oldComment: "并发控制字段。");
- }
-
- ///
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.RenameColumn(
- name: "xmin",
- table: "identity_users",
- newName: "RowVersion");
-
- migrationBuilder.AlterColumn(
- name: "RowVersion",
- table: "identity_users",
- type: "bytea",
- rowVersion: true,
- nullable: false,
- comment: "并发控制字段。",
- oldClrType: typeof(uint),
- oldType: "xid",
- oldRowVersion: true,
- oldComment: "并发控制字段(映射到 PostgreSQL xmin)。");
- }
- }
-}
diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/IdentityDb/20260205131209_SyncIdentityModel.Designer.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/IdentityDb/20260205131953_UseXminConcurrency.Designer.cs
similarity index 99%
rename from src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/IdentityDb/20260205131209_SyncIdentityModel.Designer.cs
rename to src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/IdentityDb/20260205131953_UseXminConcurrency.Designer.cs
index da86eb0..6bfc2a1 100644
--- a/src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/IdentityDb/20260205131209_SyncIdentityModel.Designer.cs
+++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/IdentityDb/20260205131953_UseXminConcurrency.Designer.cs
@@ -12,8 +12,8 @@ using TakeoutSaaS.Infrastructure.Identity.Persistence;
namespace TakeoutSaaS.Infrastructure.Migrations.IdentityDb
{
[DbContext(typeof(IdentityDbContext))]
- [Migration("20260205131209_SyncIdentityModel")]
- partial class SyncIdentityModel
+ [Migration("20260205131953_UseXminConcurrency")]
+ partial class UseXminConcurrency
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@@ -275,7 +275,7 @@ namespace TakeoutSaaS.Infrastructure.Migrations.IdentityDb
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("xid")
.HasColumnName("xmin")
- .HasComment("并发控制字段(映射到 PostgreSQL xmin)。");
+ .HasComment("并发控制字段(映射到 PostgreSQL xmin 系统列)。");
b.Property("Status")
.HasColumnType("integer")
diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/IdentityDb/20260205131953_UseXminConcurrency.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/IdentityDb/20260205131953_UseXminConcurrency.cs
new file mode 100644
index 0000000..ba4ad38
--- /dev/null
+++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/IdentityDb/20260205131953_UseXminConcurrency.cs
@@ -0,0 +1,32 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace TakeoutSaaS.Infrastructure.Migrations.IdentityDb
+{
+ ///
+ public partial class UseXminConcurrency : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ // 删除旧的 RowVersion 列,改用 PostgreSQL 原生 xmin 系统列
+ migrationBuilder.DropColumn(
+ name: "RowVersion",
+ table: "identity_users");
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ // 恢复 RowVersion 列
+ migrationBuilder.AddColumn(
+ name: "RowVersion",
+ table: "identity_users",
+ type: "bytea",
+ rowVersion: true,
+ nullable: false,
+ defaultValue: new byte[0]);
+ }
+ }
+}
diff --git a/src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/IdentityDb/IdentityDbContextModelSnapshot.cs b/src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/IdentityDb/IdentityDbContextModelSnapshot.cs
index 5452d33..4bc1cde 100644
--- a/src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/IdentityDb/IdentityDbContextModelSnapshot.cs
+++ b/src/Infrastructure/TakeoutSaaS.Infrastructure/Migrations/IdentityDb/IdentityDbContextModelSnapshot.cs
@@ -272,7 +272,7 @@ namespace TakeoutSaaS.Infrastructure.Migrations.IdentityDb
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("xid")
.HasColumnName("xmin")
- .HasComment("并发控制字段(映射到 PostgreSQL xmin)。");
+ .HasComment("并发控制字段(映射到 PostgreSQL xmin 系统列)。");
b.Property("Status")
.HasColumnType("integer")