fix: tenants 联系电话唯一索引

This commit is contained in:
2025-12-12 22:06:24 +08:00
parent aa81dddc16
commit 624a7bc04d
4 changed files with 6722 additions and 6 deletions

View File

@@ -458,6 +458,7 @@ public sealed class TakeoutAppDbContext(
builder.Property(x => x.LogoUrl).HasMaxLength(256);
builder.Property(x => x.Remarks).HasMaxLength(512);
builder.HasIndex(x => x.Code).IsUnique();
builder.HasIndex(x => x.ContactPhone).IsUnique();
}
private static void ConfigureTenantVerificationProfile(EntityTypeBuilder<TenantVerificationProfile> builder)

View File

@@ -0,0 +1,28 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace TakeoutSaaS.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddTenantContactPhoneUniqueIndex : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateIndex(
name: "IX_tenants_ContactPhone",
table: "tenants",
column: "ContactPhone",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_tenants_ContactPhone",
table: "tenants");
}
}
}

View File

@@ -5821,6 +5821,9 @@ namespace TakeoutSaaS.Infrastructure.Migrations
b.HasIndex("Code")
.IsUnique();
b.HasIndex("ContactPhone")
.IsUnique();
b.ToTable("tenants", null, t =>
{
t.HasComment("平台租户信息,描述租户的生命周期与基础资料。");
@@ -6247,12 +6250,6 @@ namespace TakeoutSaaS.Infrastructure.Migrations
.HasColumnType("boolean")
.HasComment("是否仍可售卖。");
b.Property<int>("SortOrder")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasDefaultValue(0)
.HasComment("展示排序,数值越小越靠前。");
b.Property<int?>("MaxAccountCount")
.HasColumnType("integer")
.HasComment("允许创建的最大账号数。");
@@ -6287,6 +6284,12 @@ namespace TakeoutSaaS.Infrastructure.Migrations
.HasColumnType("integer")
.HasComment("套餐分类(试用、标准、旗舰等)。");
b.Property<int>("SortOrder")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasDefaultValue(0)
.HasComment("展示排序,数值越小越靠前。");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone")
.HasComment("最近一次更新时间UTC从未更新时为 null。");