97f85ce74e
- Add `is_complimentary` column to UserProfile model (migration 019) - Update `_ensure_user_profile` to accept `is_admin` param; admins get highest subscription tier, is_complimentary=True, onboarding skipped - Call `_ensure_user_profile` from all login paths (OAuth, local user, admin creds) - Add `is_complimentary` to UserProfileUpsert schema, response helpers, list_users, get_user, upsert_user_profile in admin API - Add complimentary toggle to admin users UI with gift badge in table - Write 18 new tests covering complimentary plan and admin auto-creation - Update SubscriptionTiers.md documentation Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
31 lines
784 B
Python
31 lines
784 B
Python
"""Add is_complimentary column to user_profiles
|
|
|
|
Revision ID: 019_add_is_complimentary
|
|
Revises: 018_add_local_users_and_billing
|
|
Create Date: 2026-03-07
|
|
|
|
"""
|
|
|
|
from typing import Union
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = "019_add_is_complimentary"
|
|
down_revision: Union[str, None] = "018_add_local_users_and_billing"
|
|
depends_on: Union[str, None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
"""Add is_complimentary column to user_profiles."""
|
|
op.add_column(
|
|
"user_profiles",
|
|
sa.Column("is_complimentary", sa.Boolean(), nullable=False, server_default="0"),
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
"""Remove is_complimentary column from user_profiles."""
|
|
op.drop_column("user_profiles", "is_complimentary")
|