Commit 3fb58f1a authored by Lukáš Lalinský's avatar Lukáš Lalinský

Remove FK constraints on submission.id

parent 767ff4f1
......@@ -194,7 +194,7 @@ fingerprint = Table('fingerprint', metadata,
fingerprint_source = Table('fingerprint_source', metadata,
Column('id', Integer, primary_key=True),
Column('fingerprint_id', Integer, ForeignKey('fingerprint.id'), nullable=False),
Column('submission_id', Integer, ForeignKey('submission.id'), nullable=False),
Column('submission_id', Integer, nullable=False),
Column('source_id', Integer, ForeignKey('source.id'), nullable=False),
Column('created', DateTime(timezone=True), server_default=sql.func.current_timestamp(), nullable=False),
Index('fingerprint_source_idx_submission_id', 'submission_id'),
......@@ -217,7 +217,7 @@ track_mbid = Table('track_mbid', metadata,
track_mbid_source = Table('track_mbid_source', metadata,
Column('id', Integer, primary_key=True),
Column('track_mbid_id', Integer, ForeignKey('track_mbid.id'), nullable=False, index=True),
Column('submission_id', Integer, ForeignKey('submission.id')),
Column('submission_id', Integer),
Column('source_id', Integer, ForeignKey('source.id'), nullable=False, index=True),
Column('created', DateTime(timezone=True), server_default=sql.func.current_timestamp(), nullable=False),
)
......@@ -251,7 +251,7 @@ track_puid = Table('track_puid', metadata,
track_puid_source = Table('track_puid_source', metadata,
Column('id', Integer, primary_key=True),
Column('track_puid_id', Integer, ForeignKey('track_puid.id'), nullable=False),
Column('submission_id', Integer, ForeignKey('submission.id'), nullable=False),
Column('submission_id', Integer, nullable=False),
Column('source_id', Integer, ForeignKey('source.id'), nullable=False),
Column('created', DateTime(timezone=True), server_default=sql.func.current_timestamp(), nullable=False),
)
......@@ -268,7 +268,7 @@ track_meta = Table('track_meta', metadata,
track_meta_source = Table('track_meta_source', metadata,
Column('id', Integer, primary_key=True),
Column('track_meta_id', Integer, ForeignKey('track_meta.id'), nullable=False),
Column('submission_id', Integer, ForeignKey('submission.id'), nullable=False),
Column('submission_id', Integer, nullable=False),
Column('source_id', Integer, ForeignKey('source.id'), nullable=False),
Column('created', DateTime(timezone=True), server_default=sql.func.current_timestamp(), nullable=False),
)
......@@ -285,7 +285,7 @@ track_foreignid = Table('track_foreignid', metadata,
track_foreignid_source = Table('track_foreignid_source', metadata,
Column('id', Integer, primary_key=True),
Column('track_foreignid_id', Integer, ForeignKey('track_foreignid.id'), nullable=False),
Column('submission_id', Integer, ForeignKey('submission.id'), nullable=False),
Column('submission_id', Integer, nullable=False),
Column('source_id', Integer, ForeignKey('source.id'), nullable=False),
Column('created', DateTime(timezone=True), server_default=sql.func.current_timestamp(), nullable=False),
)
......
"""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
def upgrade():
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')
def downgrade():
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'])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment