testdays-web/alembic/versions/615057ee3945_revamp_testdays_step_1.py

35 lines
898 B
Python

"""Revamp testdays step 1
Revision ID: 615057ee3945
Revises: 31a71e8c7dfa
Create Date: 2025-04-01 13:51:43.718589
"""
# revision identifiers, used by Alembic.
revision = '615057ee3945'
down_revision = '31a71e8c7dfa'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
def upgrade():
bind = op.get_bind()
# Only PostgreSQL requires explicit constraint dropping before table drop
# SQLite drops all constraints automatically when dropping the table
if bind.dialect.name == 'postgresql':
op.drop_constraint('testcase_category_id_fkey', 'testcase', type_='foreignkey')
# These work on both PostgreSQL and SQLite
op.drop_table('category')
op.drop_table('user')
op.drop_table('event')
op.drop_table('testcase')
def downgrade():
raise Exception("Downgrade not possible")