68 lines
2.6 KiB
Python
68 lines
2.6 KiB
Python
"""empty message
|
|
|
|
Revision ID: 1595751865c1
|
|
Revises: 51f049b860bb
|
|
Create Date: 2026-07-17 16:28:58.025029
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
import sqlmodel
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = '1595751865c1'
|
|
down_revision: Union[str, Sequence[str], None] = '51f049b860bb'
|
|
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('captchas',
|
|
sa.Column('email', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
sa.Column('captcha', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
sa.Column('is_valid', sa.Boolean(), nullable=False),
|
|
sa.Column('is_unused', sa.Boolean(), nullable=False),
|
|
sa.Column('expired_at', sa.DateTime(), nullable=False),
|
|
sa.PrimaryKeyConstraint('email', 'expired_at')
|
|
)
|
|
with op.batch_alter_table('captchas', schema=None) as batch_op:
|
|
batch_op.create_index(batch_op.f('ix_captchas_captcha'), ['captcha'], unique=False)
|
|
batch_op.create_index(batch_op.f('ix_captchas_is_unused'), ['is_unused'], unique=False)
|
|
batch_op.create_index(batch_op.f('ix_captchas_is_valid'), ['is_valid'], unique=False)
|
|
|
|
op.create_table('users',
|
|
sa.Column('id', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
sa.Column('email', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
with op.batch_alter_table('users', schema=None) as batch_op:
|
|
batch_op.create_index(batch_op.f('ix_users_email'), ['email'], unique=False)
|
|
|
|
with op.batch_alter_table('conversations', schema=None) as batch_op:
|
|
batch_op.create_index(batch_op.f('ix_conversations_is_deleted'), ['is_deleted'], unique=False)
|
|
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
"""Downgrade schema."""
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
with op.batch_alter_table('conversations', schema=None) as batch_op:
|
|
batch_op.drop_index(batch_op.f('ix_conversations_is_deleted'))
|
|
|
|
with op.batch_alter_table('users', schema=None) as batch_op:
|
|
batch_op.drop_index(batch_op.f('ix_users_email'))
|
|
|
|
op.drop_table('users')
|
|
with op.batch_alter_table('captchas', schema=None) as batch_op:
|
|
batch_op.drop_index(batch_op.f('ix_captchas_is_valid'))
|
|
batch_op.drop_index(batch_op.f('ix_captchas_is_unused'))
|
|
batch_op.drop_index(batch_op.f('ix_captchas_captcha'))
|
|
|
|
op.drop_table('captchas')
|
|
# ### end Alembic commands ###
|