Files
jiaoyu/backend/alembic/versions/d4e5f6a7b8c9_add_notifications_table.py
T
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

42 lines
1.6 KiB
Python

"""add notifications table
Revision ID: d4e5f6a7b8c9
Revises: c3d4e5f6a7b8
Create Date: 2026-07-22 11:00:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
revision: str = 'd4e5f6a7b8c9'
down_revision: Union[str, None] = 'c3d4e5f6a7b8'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
op.create_table(
'notifications',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('user_id', sa.Integer(), nullable=False),
sa.Column('actor_id', sa.Integer(), nullable=True),
sa.Column('ntype', sa.String(length=32), nullable=False, server_default='comment'),
sa.Column('title', sa.String(length=200), nullable=False),
sa.Column('content', sa.String(length=500), nullable=False, server_default=''),
sa.Column('link', sa.String(length=255), nullable=False, server_default=''),
sa.Column('is_read', sa.Boolean(), nullable=False, server_default=sa.text('0')),
sa.Column('created_at', sa.DateTime(), server_default=sa.func.now(), nullable=True),
sa.ForeignKeyConstraint(['user_id'], ['users.id']),
sa.PrimaryKeyConstraint('id'),
)
op.create_index('ix_notifications_id', 'notifications', ['id'])
op.create_index('ix_notifications_user_id', 'notifications', ['user_id'])
def downgrade() -> None:
op.drop_index('ix_notifications_user_id', table_name='notifications')
op.drop_index('ix_notifications_id', table_name='notifications')
op.drop_table('notifications')