"""reports table Revision ID: 482a73a8c5bb Revises: 74911acb8bfa Create Date: 2026-06-16 12:07:15.936172 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '482a73a8c5bb' down_revision = '74911acb8bfa' branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('reports', sa.Column('id', sa.BigInteger().with_variant(sa.Integer(), 'sqlite'), autoincrement=True, nullable=False), sa.Column('listing_id', sa.BigInteger().with_variant(sa.Integer(), 'sqlite'), nullable=False), sa.Column('reporter_id', sa.BigInteger().with_variant(sa.Integer(), 'sqlite'), nullable=False), sa.Column('reason', sa.Enum('spam', 'scam', 'offensive', 'duplicate', 'miscategorized', 'other', name='reportreason'), nullable=False), sa.Column('note', sa.Text(), nullable=True), sa.Column('created_at', sa.DateTime(), nullable=False), sa.ForeignKeyConstraint(['listing_id'], ['listings.id'], ), sa.ForeignKeyConstraint(['reporter_id'], ['users.id'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('reporter_id', 'listing_id', name='uq_report_reporter_listing') ) with op.batch_alter_table('reports', schema=None) as batch_op: batch_op.create_index(batch_op.f('ix_reports_listing_id'), ['listing_id'], unique=False) batch_op.create_index(batch_op.f('ix_reports_reporter_id'), ['reporter_id'], unique=False) # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### with op.batch_alter_table('reports', schema=None) as batch_op: batch_op.drop_index(batch_op.f('ix_reports_reporter_id')) batch_op.drop_index(batch_op.f('ix_reports_listing_id')) op.drop_table('reports') # ### end Alembic commands ###