fix: fix uuid_generate_v4 only used in postgresql (#31304)

This commit is contained in:
wangxiaolei
2026-02-05 17:32:33 +08:00
committed by GitHub
parent 9e54f086dc
commit be8f265e43
2 changed files with 32 additions and 11 deletions

View File

@@ -2166,7 +2166,9 @@ class TenantCreditPool(TypeBase):
sa.Index("tenant_credit_pool_pool_type_idx", "pool_type"),
)
id: Mapped[str] = mapped_column(StringUUID, primary_key=True, server_default=text("uuid_generate_v4()"), init=False)
id: Mapped[str] = mapped_column(
StringUUID, insert_default=lambda: str(uuid4()), default_factory=lambda: str(uuid4()), init=False
)
tenant_id: Mapped[str] = mapped_column(StringUUID, nullable=False)
pool_type: Mapped[str] = mapped_column(String(40), nullable=False, default="trial", server_default="trial")
quota_limit: Mapped[int] = mapped_column(BigInteger, nullable=False, default=0)