-- ============================================================
-- 监控大屏 - user_consumption_detail 增加订单号和开票字段
-- 文件: 003_ucd_order_fields.sql
-- 日期: 2026-05-12
--
-- 消费记录流水新增 order_no（关联 balance_log.biz_order_no）和 invoiced（是否已开票）字段
-- ============================================================

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

COMMENT ON COLUMN domain_monitor.user_consumption_detail.order_no IS '订单号，对应 balance_log.biz_order_no';
COMMENT ON COLUMN domain_monitor.user_consumption_detail.invoiced IS '是否已开票';
