nopaque/migrations/versions/7d51bc4b6079_.py

32 lines
785 B
Python
Raw Normal View History

2023-01-19 07:58:57 +00:00
"""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')