python_bot/alembic/versions/7521d874503f_.py

48 lines
1.8 KiB
Python

"""empty message
Revision ID: 7521d874503f
Revises:
Create Date: 2023-06-22 15:21:26.835612
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '7521d874503f'
down_revision = None
branch_labels = None
depends_on = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('dick_requests',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('size_change', sa.Integer(), nullable=True),
sa.Column('user_id', sa.Integer(), nullable=True),
sa.Column('date_changed', sa.DateTime(), nullable=True),
sa.ForeignKeyConstraint(['user_id'], ['users.user_id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_foreign_key(None, 'user_dicks', 'users', ['user_id'], ['user_id'])
op.add_column('users', sa.Column('date_created', sa.DateTime(), nullable=True))
op.add_column('users', sa.Column('date_updated', sa.DateTime(), nullable=True))
op.drop_column('users', 'chat_id')
op.drop_column('users', 'datetimes')
op.drop_column('users', 'dick_size')
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('users', sa.Column('dick_size', sa.INTEGER(), autoincrement=False, nullable=True))
op.add_column('users', sa.Column('datetimes', postgresql.TIMESTAMP(), autoincrement=False, nullable=True))
op.add_column('users', sa.Column('chat_id', sa.BIGINT(), autoincrement=False, nullable=True))
op.drop_column('users', 'date_updated')
op.drop_column('users', 'date_created')
op.drop_constraint(None, 'user_dicks', type_='foreignkey')
op.drop_table('dick_requests')
# ### end Alembic commands ###