"""admin portal Revision ID: 6ee71c8d5e07 Revises: 8a55c5254edb Create Date: 2026-08-14 07:25:19.603206 """ 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 = '6ee71c8d5e07' down_revision: Union[str, Sequence[str], None] = '8a55c5254edb' branch_labels: Union[str, Sequence[str], None] = None depends_on: Union[str, Sequence[str], None] = None def upgrade() -> None: """Upgrade schema.""" # ### commands auto generated by Alembic - please adjust! ### op.create_table('admin_audit_log', sa.Column('id', sa.Uuid(), nullable=False), sa.Column('actor_id', sa.Uuid(), nullable=False), sa.Column('action', sa.String(length=100), nullable=False), sa.Column('target_type', sa.String(length=50), nullable=False), sa.Column('target_id', sa.Uuid(), nullable=False), sa.Column('metadata', postgresql.JSONB(astext_type=sa.Text()), nullable=True), sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False), sa.ForeignKeyConstraint(['actor_id'], ['users.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_admin_audit_log_actor_id'), 'admin_audit_log', ['actor_id'], unique=False) op.create_index(op.f('ix_admin_audit_log_created_at'), 'admin_audit_log', ['created_at'], unique=False) # server_default backfills existing rows; dropped right after since the # ORM already sends an explicit value on every insert (matches the # client-side-default style used for is_private/is_bot in the initial # migration, which didn't need a backfill because those tables were # still empty at the time). op.add_column( 'rooms', sa.Column('is_archived', sa.Boolean(), nullable=False, server_default=sa.false()), ) op.alter_column('rooms', 'is_archived', server_default=None) op.add_column( 'users', sa.Column('is_active', sa.Boolean(), nullable=False, server_default=sa.true()), ) op.alter_column('users', 'is_active', server_default=None) # ### end Alembic commands ### def downgrade() -> None: """Downgrade schema.""" # ### commands auto generated by Alembic - please adjust! ### op.drop_column('users', 'is_active') op.drop_column('rooms', 'is_archived') op.drop_index(op.f('ix_admin_audit_log_created_at'), table_name='admin_audit_log') op.drop_index(op.f('ix_admin_audit_log_actor_id'), table_name='admin_audit_log') op.drop_table('admin_audit_log') # ### end Alembic commands ###