first
This commit is contained in:
40
migrations/versions/2c5f57dddb78_add_room_members_table.py
Normal file
40
migrations/versions/2c5f57dddb78_add_room_members_table.py
Normal file
@@ -0,0 +1,40 @@
|
||||
"""Add room members table
|
||||
|
||||
Revision ID: 2c5f57dddb78
|
||||
Revises: 3a5b8d8e53cd
|
||||
Create Date: 2025-05-23 21:27:17.497481
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '2c5f57dddb78'
|
||||
down_revision = '3a5b8d8e53cd'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('room_members',
|
||||
sa.Column('room_id', sa.Integer(), nullable=False),
|
||||
sa.Column('user_id', sa.Integer(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['room_id'], ['room.id'], ),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
|
||||
sa.PrimaryKeyConstraint('room_id', 'user_id')
|
||||
)
|
||||
with op.batch_alter_table('room', schema=None) as batch_op:
|
||||
batch_op.drop_column('is_private')
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('room', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('is_private', sa.BOOLEAN(), autoincrement=False, nullable=True))
|
||||
|
||||
op.drop_table('room_members')
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user