feat(l1): add L1 columns + extend account_role CHECK constraint

Adds users.can_cover_l1, accounts.l1_seats_purchased, subscriptions.l1_seat_limit,
audit_logs.acting_as. Rotates the users.account_role CHECK constraint to include
'l1_tech' (was: 'owner', 'admin', 'engineer', 'viewer').

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-28 12:19:38 -04:00
parent 8cf6a66154
commit c977196206
5 changed files with 71 additions and 2 deletions

View File

@@ -57,6 +57,11 @@ class Account(Base):
team_size_bucket: Mapped[Optional[str]] = mapped_column(String(20), nullable=True)
primary_psa: Mapped[Optional[str]] = mapped_column(String(20), nullable=True)
# L1 workspace seats
l1_seats_purchased: Mapped[int] = mapped_column(
Integer, nullable=False, server_default="0"
)
# SSO / SAML groundwork (Task 11)
sso_enabled: Mapped[bool] = mapped_column(Boolean, default=False, server_default="false")
sso_provider: Mapped[Optional[str]] = mapped_column(String(20), nullable=True) # "saml" | "oidc"