chat_back/app/migrations/versions/ad488d81e7b5_изменение_models_py.py

37 lines
1.1 KiB
Python

"""Изменение models.py
Revision ID: ad488d81e7b5
Revises: 3ed46f38168f
Create Date: 2024-01-31 19:11:16.016911
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = 'ad488d81e7b5'
down_revision: Union[str, None] = '3ed46f38168f'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('usersxchats',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('user_id', sa.Integer(), nullable=True),
sa.Column('chat_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['chat_id'], ['chats.id'], ),
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('usersxchats')
# ### end Alembic commands ###