ALTER TABLE tb_iot_card ADD COLUMN IF NOT EXISTS virtual_no VARCHAR(50);

CREATE UNIQUE INDEX IF NOT EXISTS idx_iot_card_virtual_no
    ON tb_iot_card(virtual_no)
    WHERE deleted_at IS NULL AND virtual_no IS NOT NULL AND virtual_no <> '';

COMMENT ON COLUMN tb_iot_card.virtual_no IS '虚拟号(可空，全局唯一)';
