"""Add color to asset subtype tables (data-driven map colors)

The map colors equipment/computer/network/printer subtypes round-robin from a
palette. Give each subtype table a color column so a site can set stable, chosen
colors that the map reads instead of the auto-assigned palette.

Revision ID: 7d09_subtype_colors
Revises: 7d08_tvslides
Create Date: 2026-07-09

"""
from alembic import op
import sqlalchemy as sa


revision = '7d09_subtype_colors'
down_revision = '7d08_tvslides'
branch_labels = None
depends_on = None

TABLES = ['equipmenttypes', 'computertypes', 'networkdevicetypes', 'printertypes']


def upgrade():
    for table in TABLES:
        op.add_column(table, sa.Column('color', sa.String(length=20), nullable=True))


def downgrade():
    for table in TABLES:
        op.drop_column(table, 'color')
