1
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
"""collection_sources 增加 kind/config(接口类采集源)
|
||||
|
||||
Revision ID: a7c2e5f18b04
|
||||
Revises: f1b7d4a9c310
|
||||
Create Date: 2026-10-24 15:00:00.000000
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
revision = 'a7c2e5f18b04'
|
||||
down_revision = 'f1b7d4a9c310'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.add_column('collection_sources', sa.Column(
|
||||
'kind', sa.String(length=20), nullable=False, server_default='url',
|
||||
comment='采集类型 url/aidrama91'))
|
||||
# TEXT 在 MySQL 上不能用普通默认值:先加可空列,回填空串后再收紧
|
||||
op.add_column('collection_sources', sa.Column('config', sa.Text(), nullable=True))
|
||||
op.execute("UPDATE collection_sources SET config = '' WHERE config IS NULL")
|
||||
op.alter_column('collection_sources', 'config', nullable=False,
|
||||
existing_type=sa.Text(), existing_nullable=True)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_column('collection_sources', 'config')
|
||||
op.drop_column('collection_sources', 'kind')
|
||||
Reference in New Issue
Block a user