new-site/api/migrations/024_crtc_trade_name.sql
justin f8cd37ac8c Initial commit — Performance West telecom compliance platform
Includes: API (Express/TypeScript), Astro site, Python workers,
document generators, FCC compliance tools, Canada CRTC formation,
Ansible infrastructure, and deployment scripts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-27 06:54:22 -05:00

17 lines
645 B
PL/PgSQL

-- 024_crtc_trade_name.sql
-- Add trade name support to canada_crtc_orders.
BEGIN;
-- Add trade name columns
ALTER TABLE canada_crtc_orders
ADD COLUMN IF NOT EXISTS trade_name TEXT,
ADD COLUMN IF NOT EXISTS add_trade_name BOOLEAN DEFAULT FALSE;
-- Expand company_type CHECK to include numbered_tradename
-- Drop old constraint and recreate (PG doesn't support ALTER CONSTRAINT)
ALTER TABLE canada_crtc_orders DROP CONSTRAINT IF EXISTS canada_crtc_orders_company_type_check;
ALTER TABLE canada_crtc_orders ADD CONSTRAINT canada_crtc_orders_company_type_check
CHECK (company_type IN ('numbered', 'numbered_tradename', 'named'));
COMMIT;