Support-BOT
This commit is contained in:
42
alembic/versions/3de147b35e89_fix_telegram_ids.py
Normal file
42
alembic/versions/3de147b35e89_fix_telegram_ids.py
Normal file
@@ -0,0 +1,42 @@
|
||||
"""fix telegram ids
|
||||
|
||||
Revision ID: 3de147b35e89
|
||||
Revises: 559d3cc36e6e
|
||||
Create Date: 2023-06-08 16:41:33.395065
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '3de147b35e89'
|
||||
down_revision = '559d3cc36e6e'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column('message', 'telegram_user_id',
|
||||
existing_type=sa.INTEGER(),
|
||||
type_=sa.BigInteger(),
|
||||
existing_nullable=False)
|
||||
op.alter_column('message', 'answer_to_user_id',
|
||||
existing_type=sa.INTEGER(),
|
||||
type_=sa.BigInteger(),
|
||||
existing_nullable=True)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column('message', 'answer_to_user_id',
|
||||
existing_type=sa.BigInteger(),
|
||||
type_=sa.INTEGER(),
|
||||
existing_nullable=True)
|
||||
op.alter_column('message', 'telegram_user_id',
|
||||
existing_type=sa.BigInteger(),
|
||||
type_=sa.INTEGER(),
|
||||
existing_nullable=False)
|
||||
# ### end Alembic commands ###
|
||||
53
alembic/versions/559d3cc36e6e_first_commit.py
Normal file
53
alembic/versions/559d3cc36e6e_first_commit.py
Normal file
@@ -0,0 +1,53 @@
|
||||
"""first commit
|
||||
|
||||
Revision ID: 559d3cc36e6e
|
||||
Revises:
|
||||
Create Date: 2023-04-10 13:09:57.880742
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '559d3cc36e6e'
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('user',
|
||||
sa.Column('telegram_id', sa.BigInteger(), nullable=False),
|
||||
sa.Column('telegram_username', sa.String(length=100), nullable=True),
|
||||
sa.Column('is_banned', sa.Boolean(), nullable=True),
|
||||
sa.Column('first_name', sa.String(length=100), nullable=True),
|
||||
sa.Column('last_name', sa.String(length=100), nullable=True),
|
||||
sa.Column('is_admin', sa.Boolean(), nullable=True),
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('created_at', sa.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
|
||||
sa.Column('updated_at', sa.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('telegram_id')
|
||||
)
|
||||
op.create_table('message',
|
||||
sa.Column('telegram_user_id', sa.Integer(), nullable=False),
|
||||
sa.Column('answer_to_user_id', sa.Integer(), nullable=True),
|
||||
sa.Column('text', sa.Text(), nullable=True),
|
||||
sa.Column('attachments', sa.Boolean(), nullable=True),
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('created_at', sa.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
|
||||
sa.Column('updated_at', sa.TIMESTAMP(), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
|
||||
sa.ForeignKeyConstraint(['answer_to_user_id'], ['user.telegram_id'], ),
|
||||
sa.ForeignKeyConstraint(['telegram_user_id'], ['user.telegram_id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('message')
|
||||
op.drop_table('user')
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user