mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-26 03:14:19 +00:00
32 lines
785 B
Python
32 lines
785 B
Python
"""Add user_followers table
|
|
|
|
Revision ID: 7d51bc4b6079
|
|
Revises: 4aa88f253dab
|
|
Create Date: 2023-01-17 12:48:33.261942
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '7d51bc4b6079'
|
|
down_revision = '4aa88f253dab'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
op.create_table(
|
|
'user_followers',
|
|
sa.Column('follower_user_id', sa.Integer(), nullable=False),
|
|
sa.Column('followed_user_id', sa.Integer(), nullable=False),
|
|
sa.ForeignKeyConstraint(['followed_user_id'], ['users.id'], ),
|
|
sa.ForeignKeyConstraint(['follower_user_id'], ['users.id'], ),
|
|
sa.PrimaryKeyConstraint('follower_user_id', 'followed_user_id')
|
|
)
|
|
|
|
|
|
def downgrade():
|
|
op.drop_table('user_followers')
|