"""Add updated_at column to notifications table. Revision ID: 0020 Revises: 0019 Create Date: 2026-07-16 """ from alembic import op import sqlalchemy as sa revision = "0020" down_revision = "0019_rbac_groups" branch_labels = None depends_on = None def upgrade() -> None: conn = op.get_bind() result = conn.execute( sa.text( "SELECT column_name FROM information_schema.columns " "WHERE table_name = 'notifications' AND column_name = 'updated_at'" ) ) if result.fetchone() is None: op.add_column( "notifications", sa.Column( "updated_at", sa.DateTime(timezone=True), nullable=False, server_default=sa.func.now(), ), ) def downgrade() -> None: op.drop_column("notifications", "updated_at")