Files
jiaoyu/backend/alembic/versions/c3d4e5f6a7b8_add_reset_codes_table.py
Zhang Jing Xuan 0841b1a103 智教助手平台:完整初始化
- 前端:Vue3 + TS + Element Plus,24 个页面路由(课件/组题/教案/动画/思维导图/作文批改/命题/课堂/资源/社区等)
- 后端:FastAPI + SQLAlchemy + SQLite,17 个路由模块,AI 服务层含降级模板
- AI:glm-5.x 推理模型已禁用思维链,确保输出真实内容
- 修复:ai_service 两处请求体注入 enable_thinking/thinking disabled
- 测试账号:13900999999 / test1234
2026-07-29 16:29:10 +08:00

38 lines
1.2 KiB
Python

"""add reset codes table
Revision ID: c3d4e5f6a7b8
Revises: b2c3d4e5f6a7
Create Date: 2026-07-22 10:00:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
revision: str = 'c3d4e5f6a7b8'
down_revision: Union[str, None] = 'b2c3d4e5f6a7'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
op.create_table(
'reset_codes',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('phone', sa.String(length=20), nullable=False),
sa.Column('code', sa.String(length=6), nullable=False),
sa.Column('consumed', sa.Integer(), nullable=False, server_default='0'),
sa.Column('expires_at', sa.DateTime(), nullable=False),
sa.Column('created_at', sa.DateTime(), server_default=sa.func.now(), nullable=True),
sa.PrimaryKeyConstraint('id'),
)
op.create_index('ix_reset_codes_id', 'reset_codes', ['id'])
op.create_index('ix_reset_codes_phone', 'reset_codes', ['phone'])
def downgrade() -> None:
op.drop_index('ix_reset_codes_phone', table_name='reset_codes')
op.drop_index('ix_reset_codes_id', table_name='reset_codes')
op.drop_table('reset_codes')