f1f8518985
feat(auth): 添加用户权限获取接口并完善JWT令牌角色信息 - 在JWT令牌中添加用户角色信息 - 新增get_my_permissions接口用于获取当前用户权限码列表 - 重构认证回调逻辑,增加错误日志记录 - 更新用户信息获取接口使用Authorization头验证 ```
33 lines
1.0 KiB
Python
33 lines
1.0 KiB
Python
"""add device_daily_snapshots table
|
|
|
|
Revision ID: e5f6a7b8c9d0
|
|
Revises: d4e5f6a7b8c9
|
|
Create Date: 2026-04-05
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
revision = 'e5f6a7b8c9d0'
|
|
down_revision = 'd4e5f6a7b8c9'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
op.create_table(
|
|
'device_daily_snapshots',
|
|
sa.Column('id', sa.BigInteger(), primary_key=True, index=True),
|
|
sa.Column('snapshot_date', sa.String(10), nullable=False),
|
|
sa.Column('total', sa.Integer(), nullable=False, server_default='0'),
|
|
sa.Column('online', sa.Integer(), nullable=False, server_default='0'),
|
|
sa.Column('offline', sa.Integer(), nullable=False, server_default='0'),
|
|
sa.Column('created_at', sa.TIMESTAMP(), server_default=sa.text('now()')),
|
|
)
|
|
op.create_index('ix_device_daily_snapshots_snapshot_date', 'device_daily_snapshots', ['snapshot_date'])
|
|
|
|
|
|
def downgrade():
|
|
op.drop_index('ix_device_daily_snapshots_snapshot_date', 'device_daily_snapshots')
|
|
op.drop_table('device_daily_snapshots')
|