feat: add account-based subscription model with migrations
Transition from team-based to account-based multi-tenancy (Free/Pro/Team). Migrations 016-020 create accounts, subscriptions, plan_limits, and account_invites tables, then migrate existing users and content FKs. New models: Account, Subscription, PlanLimits, AccountInvite. Updated models add account_id alongside existing team_id (coexistence for safe two-PR deployment). Permissions and deps refactored for account_role instead of is_team_admin. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
16
backend/app/models/plan_limits.py
Normal file
16
backend/app/models/plan_limits.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from sqlalchemy import String, Integer, Boolean
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
from sqlalchemy.dialects.postgresql import JSONB
|
||||
from app.core.database import Base
|
||||
|
||||
|
||||
class PlanLimits(Base):
|
||||
__tablename__ = "plan_limits"
|
||||
|
||||
plan: Mapped[str] = mapped_column(String(50), primary_key=True)
|
||||
max_trees: Mapped[int | None] = mapped_column(Integer, nullable=True)
|
||||
max_sessions_per_month: Mapped[int | None] = mapped_column(Integer, nullable=True)
|
||||
max_users: Mapped[int | None] = mapped_column(Integer, nullable=True)
|
||||
custom_branding: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
|
||||
priority_support: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
|
||||
export_formats: Mapped[list] = mapped_column(JSONB, nullable=False, default=lambda: ["markdown", "text"])
|
||||
Reference in New Issue
Block a user