80 lines
2.7 KiB
Python
80 lines
2.7 KiB
Python
"""放宽敏感字段列类型,便于存储加密密文
|
|
|
|
Revision ID: 20260624_0002
|
|
Revises: 20260623_0001
|
|
Create Date: 2026-06-24
|
|
"""
|
|
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
revision: str = "20260624_0002"
|
|
down_revision: Union[str, None] = "20260623_0001"
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
with op.batch_alter_table("accounts") as batch:
|
|
batch.alter_column(
|
|
"password", existing_type=sa.String(length=256), type_=sa.Text()
|
|
)
|
|
batch.alter_column(
|
|
"email", existing_type=sa.String(length=128), type_=sa.Text()
|
|
)
|
|
batch.alter_column(
|
|
"email_password", existing_type=sa.String(length=256), type_=sa.Text()
|
|
)
|
|
|
|
with op.batch_alter_table("proxy_config") as batch:
|
|
batch.alter_column(
|
|
"api_url", existing_type=sa.String(length=512), type_=sa.Text()
|
|
)
|
|
batch.alter_column("http", existing_type=sa.String(length=256), type_=sa.Text())
|
|
batch.alter_column(
|
|
"https", existing_type=sa.String(length=256), type_=sa.Text()
|
|
)
|
|
batch.alter_column(
|
|
"whitelist_uid", existing_type=sa.String(length=64), type_=sa.Text()
|
|
)
|
|
batch.alter_column(
|
|
"whitelist_ukey", existing_type=sa.String(length=128), type_=sa.Text()
|
|
)
|
|
|
|
with op.batch_alter_table("login_tasks") as batch:
|
|
batch.alter_column("cookie", existing_type=sa.Text(), type_=sa.Text())
|
|
|
|
|
|
def downgrade() -> None:
|
|
with op.batch_alter_table("login_tasks") as batch:
|
|
batch.alter_column("cookie", existing_type=sa.Text(), type_=sa.Text())
|
|
|
|
with op.batch_alter_table("proxy_config") as batch:
|
|
batch.alter_column(
|
|
"whitelist_ukey", existing_type=sa.Text(), type_=sa.String(length=128)
|
|
)
|
|
batch.alter_column(
|
|
"whitelist_uid", existing_type=sa.Text(), type_=sa.String(length=64)
|
|
)
|
|
batch.alter_column(
|
|
"https", existing_type=sa.Text(), type_=sa.String(length=256)
|
|
)
|
|
batch.alter_column("http", existing_type=sa.Text(), type_=sa.String(length=256))
|
|
batch.alter_column(
|
|
"api_url", existing_type=sa.Text(), type_=sa.String(length=512)
|
|
)
|
|
|
|
with op.batch_alter_table("accounts") as batch:
|
|
batch.alter_column(
|
|
"email_password", existing_type=sa.Text(), type_=sa.String(length=256)
|
|
)
|
|
batch.alter_column(
|
|
"email", existing_type=sa.Text(), type_=sa.String(length=128)
|
|
)
|
|
batch.alter_column(
|
|
"password", existing_type=sa.Text(), type_=sa.String(length=256)
|
|
)
|