47 lines
1.6 KiB
Python
47 lines
1.6 KiB
Python
"""empty message
|
|
|
|
Revision ID: e05e08cbaa82
|
|
Revises:
|
|
Create Date: 2026-06-23 10:49:22.696176
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
import sqlmodel
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = 'e05e08cbaa82'
|
|
down_revision: Union[str, Sequence[str], None] = None
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
"""Upgrade schema."""
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('messagehistory',
|
|
sa.Column('id', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
sa.Column('chat_id', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
sa.Column('new_message', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
sa.Column('create_at', sa.Integer(), nullable=False),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
with op.batch_alter_table('messagehistory', schema=None) as batch_op:
|
|
batch_op.create_index(batch_op.f('ix_messagehistory_chat_id'), ['chat_id'], unique=False)
|
|
batch_op.create_index(batch_op.f('ix_messagehistory_create_at'), ['create_at'], unique=False)
|
|
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
"""Downgrade schema."""
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
with op.batch_alter_table('messagehistory', schema=None) as batch_op:
|
|
batch_op.drop_index(batch_op.f('ix_messagehistory_create_at'))
|
|
batch_op.drop_index(batch_op.f('ix_messagehistory_chat_id'))
|
|
|
|
op.drop_table('messagehistory')
|
|
# ### end Alembic commands ###
|