"""add_group_upstream_and_product_provision_config

Revision ID: 4952d846795f
Revises: fc349d0897f2
Create Date: 2026-05-16 22:20:18.251187

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa

revision: str = '4952d846795f'
down_revision: Union[str, None] = 'fc349d0897f2'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    op.add_column('product_groups', sa.Column('area', sa.Integer(), nullable=True, comment='魔方云区域ID'))
    op.add_column('product_groups', sa.Column('node', sa.Integer(), nullable=True, comment='魔方云节点ID'))
    op.add_column('product_groups', sa.Column('os_options', sa.JSON(), nullable=True, comment='OS选项列表 [{label, value}]'))
    op.add_column('products', sa.Column('provision_config', sa.JSON(), nullable=True, comment='产品配置字段列表 [ConfigField]'))


def downgrade() -> None:
    op.drop_column('products', 'provision_config')
    op.drop_column('product_groups', 'os_options')
    op.drop_column('product_groups', 'node')
    op.drop_column('product_groups', 'area')
