-- ============================================================
-- 存量表补充字段（安全幂等，已存在的列会自动跳过）
-- ============================================================

-- monitored_domains 补充 remark / super_admin_id
ALTER TABLE domain_monitor.monitored_domains
ADD COLUMN IF NOT EXISTS remark VARCHAR(500);

ALTER TABLE domain_monitor.monitored_domains
ADD COLUMN IF NOT EXISTS super_admin_id INTEGER;

-- super_admin 补充 remark / source_domain
ALTER TABLE domain_monitor.super_admin
ADD COLUMN IF NOT EXISTS remark VARCHAR(500);

ALTER TABLE domain_monitor.super_admin
ADD COLUMN IF NOT EXISTS source_domain VARCHAR(200);

-- user_consumption_detail 补充字段
ALTER TABLE domain_monitor.user_consumption_detail
ADD COLUMN IF NOT EXISTS username VARCHAR;

ALTER TABLE domain_monitor.user_consumption_detail
ADD COLUMN IF NOT EXISTS order_no VARCHAR;

ALTER TABLE domain_monitor.user_consumption_detail
ADD COLUMN IF NOT EXISTS invoiced BOOLEAN DEFAULT FALSE;

ALTER TABLE domain_monitor.user_consumption_detail
ADD COLUMN IF NOT EXISTS super_admin_discount NUMERIC(10, 4) DEFAULT 1.0000;

ALTER TABLE domain_monitor.user_consumption_detail
ADD COLUMN IF NOT EXISTS super_admin_actual_price NUMERIC(20, 4);
