fix(billing): make quota seed and column names match the product SSOT
The product plan is the only source for quota numbers, but the 0001 seed used a second set (agent_chat 20/50, tryon hard 10) and omitted hairstyle, hd_export and report regen. Migration 0003 replaces the seed and renames points_reserved → quota_reserved and bonus_value → bonus_granted so the docs and the schema stop contradicting each other. Effective limit now clips at hard_cap. CI runs the integration slice against the Postgres/Redis services it already starts.
This commit is contained in:
@@ -127,8 +127,9 @@ class Quota(Base):
|
||||
quota_key: Mapped[str] = mapped_column(String(64), nullable=False)
|
||||
period_key: Mapped[str] = mapped_column(String(32), nullable=False)
|
||||
used: Mapped[int] = mapped_column(Integer, nullable=False, default=0)
|
||||
# 本周期创建时从规则拷下的 base_limit。规则中途被改,本周期仍按快照判定。
|
||||
limit_value: Mapped[int] = mapped_column(Integer, nullable=False)
|
||||
bonus_value: Mapped[int] = mapped_column(Integer, nullable=False, default=0)
|
||||
bonus_granted: Mapped[int] = mapped_column(Integer, nullable=False, default=0)
|
||||
updated_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True), nullable=False, server_default=func.now()
|
||||
)
|
||||
@@ -190,7 +191,7 @@ class Task(Base):
|
||||
error_code: Mapped[int | None] = mapped_column(Integer)
|
||||
error_message: Mapped[str | None] = mapped_column(String(512))
|
||||
retry_count: Mapped[int] = mapped_column(SmallInteger, nullable=False, default=0)
|
||||
points_reserved: Mapped[int] = mapped_column(Integer, nullable=False, default=0)
|
||||
quota_reserved: Mapped[int] = mapped_column(Integer, nullable=False, default=0)
|
||||
reserve_tx_id: Mapped[int | None] = mapped_column(BigInteger)
|
||||
submitted_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True), nullable=False, server_default=func.now()
|
||||
|
||||
Reference in New Issue
Block a user