-- 新增 realname_policy 字段到四张表
-- 实名认证策略：(none=无需实名, before_order=先实名后充值/购买, after_order=先充值/购买后实名)
-- 默认值为 none，存量数据不受影响

-- tb_iot_card 新增 realname_policy 字段
ALTER TABLE tb_iot_card ADD COLUMN IF NOT EXISTS realname_policy VARCHAR(20) NOT NULL DEFAULT 'none';
COMMENT ON COLUMN tb_iot_card.realname_policy IS '实名认证策略(none=无需实名,before_order=先实名后充值/购买,after_order=先充值/购买后实名)';

-- tb_device 新增 realname_policy 字段
ALTER TABLE tb_device ADD COLUMN IF NOT EXISTS realname_policy VARCHAR(20) NOT NULL DEFAULT 'none';
COMMENT ON COLUMN tb_device.realname_policy IS '实名认证策略(none=无需实名,before_order=先实名后充值/购买,after_order=先充值/购买后实名)';

-- tb_iot_card_import_task 新增 realname_policy 字段
ALTER TABLE tb_iot_card_import_task ADD COLUMN IF NOT EXISTS realname_policy VARCHAR(20) NOT NULL DEFAULT 'none';
COMMENT ON COLUMN tb_iot_card_import_task.realname_policy IS '导入批次实名策略(none=无需实名,before_order=先实名后充值/购买,after_order=先充值/购买后实名)';

-- tb_device_import_task 新增 realname_policy 字段
ALTER TABLE tb_device_import_task ADD COLUMN IF NOT EXISTS realname_policy VARCHAR(20) NOT NULL DEFAULT 'none';
COMMENT ON COLUMN tb_device_import_task.realname_policy IS '导入批次实名策略(none=无需实名,before_order=先实名后充值/购买,after_order=先充值/购买后实名)';