Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions migrations/versions/7793881905c5_.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
"""split last_passed_on into two

Revision ID: 7793881905c5
Revises: b3ed927671bd
Create Date: 2025-07-24 09:51:55.814649

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql

# revision identifiers, used by Alembic.
revision = '7793881905c5'
down_revision = 'b3ed927671bd'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('regression_test', schema=None) as batch_op:
batch_op.add_column(sa.Column('last_passed_on_windows', sa.Integer(), nullable=True))
batch_op.add_column(sa.Column('last_passed_on_linux', sa.Integer(), nullable=True))
batch_op.drop_constraint('regression_test_ibfk_2', type_='foreignkey')
batch_op.drop_constraint('regression_test_ibfk_1', type_='foreignkey')
batch_op.create_foreign_key(None, 'test', ['last_passed_on_windows'], ['id'], onupdate='CASCADE', ondelete='SET NULL')
batch_op.create_foreign_key(None, 'test', ['last_passed_on_linux'], ['id'], onupdate='CASCADE', ondelete='SET NULL')
batch_op.create_foreign_key(None, 'sample', ['sample_id'], ['id'], onupdate='CASCADE', ondelete='CASCADE')
batch_op.drop_column('last_passed_on')

# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('regression_test', schema=None) as batch_op:
batch_op.add_column(sa.Column('last_passed_on', mysql.INTEGER(), autoincrement=False, nullable=True))
batch_op.drop_constraint(None, type_='foreignkey')
batch_op.drop_constraint(None, type_='foreignkey')
batch_op.drop_constraint(None, type_='foreignkey')
batch_op.create_foreign_key('regression_test_ibfk_1', 'sample', ['sample_id'], ['id'], onupdate='CASCADE')
batch_op.create_foreign_key('regression_test_ibfk_2', 'test', ['last_passed_on'], ['id'], onupdate='CASCADE', ondelete='SET NULL')
batch_op.drop_column('last_passed_on_linux')
batch_op.drop_column('last_passed_on_windows')

# ### end Alembic commands ###
Loading