32 lines
940 B
Python
32 lines
940 B
Python
"""Изменение models.py
|
|
|
|
Revision ID: 5d84c98e0f22
|
|
Revises: ad488d81e7b5
|
|
Create Date: 2024-01-31 20:35:24.317899
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = '5d84c98e0f22'
|
|
down_revision: Union[str, None] = 'ad488d81e7b5'
|
|
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.add_column('chats', sa.Column('chat_for', sa.Integer(), nullable=True))
|
|
op.create_foreign_key(None, 'chats', 'users', ['chat_for'], ['id'])
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_constraint(None, 'chats', type_='foreignkey')
|
|
op.drop_column('chats', 'chat_for')
|
|
# ### end Alembic commands ###
|