ae7e1e5763ef_remove_submission_id_constraints.py 1.71 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
"""Remove submission_id constraints

Revision ID: ae7e1e5763ef
Revises: d5c0520500a6
Create Date: 2017-11-12 13:18:02.175779

"""

# revision identifiers, used by Alembic.
revision = 'ae7e1e5763ef'
down_revision = 'd5c0520500a6'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa


Lukáš Lalinský's avatar
Lukáš Lalinský committed
19 20 21 22 23 24 25 26
def upgrade(engine_name):
    globals()["upgrade_%s" % engine_name]()


def downgrade(engine_name):
    globals()["downgrade_%s" % engine_name]()


27
def upgrade_main():
28 29 30 31 32 33 34
    op.drop_constraint(u'fingerprint_source_fk_submission_id', 'fingerprint_source', type_='foreignkey')
    op.drop_constraint(u'track_foreignid_source_fk_submission_id', 'track_foreignid_source', type_='foreignkey')
    op.drop_constraint(u'track_mbid_source_fk_submission_id', 'track_mbid_source', type_='foreignkey')
    op.drop_constraint(u'track_meta_source_fk_submission_id', 'track_meta_source', type_='foreignkey')
    op.drop_constraint(u'track_puid_source_fk_submission_id', 'track_puid_source', type_='foreignkey')


35
def downgrade_main():
36 37 38 39 40
    op.create_foreign_key(u'track_puid_source_fk_submission_id', 'track_puid_source', 'submission', ['submission_id'], ['id'])
    op.create_foreign_key(u'track_meta_source_fk_submission_id', 'track_meta_source', 'submission', ['submission_id'], ['id'])
    op.create_foreign_key(u'track_mbid_source_fk_submission_id', 'track_mbid_source', 'submission', ['submission_id'], ['id'])
    op.create_foreign_key(u'track_foreignid_source_fk_submission_id', 'track_foreignid_source', 'submission', ['submission_id'], ['id'])
    op.create_foreign_key(u'fingerprint_source_fk_submission_id', 'fingerprint_source', 'submission', ['submission_id'], ['id'])
Lukáš Lalinský's avatar
Lukáš Lalinský committed
41 42


43
def upgrade_import():
Lukáš Lalinský's avatar
Lukáš Lalinský committed
44 45 46
    pass


47
def downgrade_import():
Lukáš Lalinský's avatar
Lukáš Lalinský committed
48
    pass