"""202603131028

Revision ID: 01587a13522f
Revises: fb834419b18f
Create Date: 2026-03-13 10:28:43.601370

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision: str = '01587a13522f'
down_revision: Union[str, None] = 'fb834419b18f'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('tenants', sa.Column('default_language', sa.String(length=10), server_default='zh', nullable=False))
    op.add_column('tenants', sa.Column('supported_languages', postgresql.ARRAY(sa.String(length=10)), server_default=sa.text("'{zh,en}'"), nullable=False))
    op.create_index(op.f('ix_tenants_default_language'), 'tenants', ['default_language'], unique=False)
    op.add_column('users', sa.Column('preferred_language', sa.String(length=10), server_default=sa.text("'zh'"), nullable=False))
    op.create_index(op.f('ix_users_preferred_language'), 'users', ['preferred_language'], unique=False)
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_users_preferred_language'), table_name='users')
    op.drop_column('users', 'preferred_language')
    op.drop_index(op.f('ix_tenants_default_language'), table_name='tenants')
    op.drop_column('tenants', 'supported_languages')
    op.drop_column('tenants', 'default_language')
    # ### end Alembic commands ###
