"""add company_id to cfo_connections

Revision ID: 000000000008
Revises: 000000000007
Create Date: 2026-02-12

Adds a nullable company_id UUID column to the cfo_connections table.
This is a soft reference to cfo_companies.id in the CFO database.
No foreign key constraint — the reference is cross-database.
"""

from alembic import op

revision = "000000000008"
down_revision = "000000000007"
branch_labels = None
depends_on = None


def upgrade() -> None:
    op.execute("""
        ALTER TABLE cfo_connections
        ADD COLUMN IF NOT EXISTS company_id UUID NULL;
    """)
    op.execute("""
        COMMENT ON COLUMN cfo_connections.company_id
        IS 'Soft reference to cfo_companies.id in CFO DB (no FK constraint)';
    """)


def downgrade() -> None:
    op.execute("""
        ALTER TABLE cfo_connections
        DROP COLUMN IF EXISTS company_id;
    """)
