feat(migrations): 新增 alembic 迁移(public_nav / nav_category / 友链 / 访问统计)

This commit is contained in:
bwstudio
2026-09-06 21:34:39 +08:00
parent 0bfe6f9d8c
commit 1a33648b9a
11 changed files with 624 additions and 0 deletions
@@ -0,0 +1,34 @@
"""rename public_nav.status to public_nav.enable
Revision ID: 1a4b7cd9005e
Revises: ec7c5d1aab2e
Create Date: 2026-09-05 18:05:00.000000
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = '1a4b7cd9005e'
down_revision = 'ec7c5d1aab2e'
branch_labels = None
depends_on = None
def upgrade():
# SQLite 不支持直接 ALTER COLUMN 改名,必须新建 + 拷贝 + 删除
with op.batch_alter_table('public_nav', schema=None) as batch_op:
batch_op.alter_column(
'status',
new_column_name='enable',
existing_comment='状态(1启用,0关闭)',
)
def downgrade():
with op.batch_alter_table('public_nav', schema=None) as batch_op:
batch_op.alter_column(
'enable',
new_column_name='status',
existing_comment='状态(1启用,0关闭)',
)