From f7b6ccdccc84d2d1653e9fcaf9fe3e66d6073a18 Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Wed, 30 Aug 2023 19:25:49 +0200 Subject: add alembic migration for favourite table --- .../alembic/versions/20230830_8f4e4eae5eb2.py | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 fietsboek/alembic/versions/20230830_8f4e4eae5eb2.py diff --git a/fietsboek/alembic/versions/20230830_8f4e4eae5eb2.py b/fietsboek/alembic/versions/20230830_8f4e4eae5eb2.py new file mode 100644 index 0000000..c6abf33 --- /dev/null +++ b/fietsboek/alembic/versions/20230830_8f4e4eae5eb2.py @@ -0,0 +1,32 @@ +"""add favourite association table + +Revision ID: 8f4e4eae5eb2 +Revises: 3149aa2d0114 +Create Date: 2023-08-30 19:19:54.545517 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '8f4e4eae5eb2' +down_revision = '3149aa2d0114' +branch_labels = None +depends_on = None + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.create_table('track_favourite_assoc', + sa.Column('track_id', sa.Integer(), nullable=False), + sa.Column('user_id', sa.Integer(), nullable=False), + sa.ForeignKeyConstraint(['track_id'], ['tracks.id'], name=op.f('fk_track_favourite_assoc_track_id_tracks')), + sa.ForeignKeyConstraint(['user_id'], ['users.id'], name=op.f('fk_track_favourite_assoc_user_id_users')), + sa.PrimaryKeyConstraint('track_id', 'user_id', name=op.f('pk_track_favourite_assoc')) + ) + # ### end Alembic commands ### + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_table('track_favourite_assoc') + # ### end Alembic commands ### -- cgit v1.2.3