Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

refactor: port TenantCreditPool (#30926)

Asuka Minato2f633de45e01
diff --git a/api/models/model.py b/api/models/model.py
index a48f4d34d4b..463693cfbae 100644
--- a/api/models/model.py
+++ b/api/models/model.py
@@ -2083,7 +2083,7 @@ class TraceAppConfig(TypeBase):
}
-class TenantCreditPool(Base):
+class TenantCreditPool(TypeBase):
__tablename__ = "tenant_credit_pools"
__table_args__ = (
sa.PrimaryKeyConstraint("id", name="tenant_credit_pool_pkey"),
@@ -2091,14 +2091,20 @@ class TenantCreditPool(Base):
sa.Index("tenant_credit_pool_pool_type_idx", "pool_type"),
)
- id = mapped_column(StringUUID, primary_key=True, server_default=text("uuid_generate_v4()"))
- tenant_id = mapped_column(StringUUID, nullable=False)
- pool_type = mapped_column(String(40), nullable=False, default="trial", server_default="trial")
- quota_limit = mapped_column(BigInteger, nullable=False, default=0)
- quota_used = mapped_column(BigInteger, nullable=False, default=0)
- created_at = mapped_column(sa.DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP"))
- updated_at = mapped_column(
- sa.DateTime, nullable=False, server_default=func.current_timestamp(), onupdate=func.current_timestamp()
+ id: Mapped[str] = mapped_column(StringUUID, primary_key=True, server_default=text("uuid_generate_v4()"), 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)
+ quota_used: Mapped[int] = mapped_column(BigInteger, nullable=False, default=0)
+ created_at: Mapped[datetime] = mapped_column(
+ sa.DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP"), init=False
+ )
+ updated_at: Mapped[datetime] = mapped_column(
+ sa.DateTime,
+ nullable=False,
+ server_default=func.current_timestamp(),
+ onupdate=func.current_timestamp(),
+ init=False,
)
@property