Files
pear-admin-flask/migrations/versions/1a4b7cd9005e_rename_public_nav_status_to_enable.py
T

35 lines
877 B
Python

"""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关闭)',
)