BEGIN;

LOCK TABLE tb_iot_card IN ACCESS EXCLUSIVE MODE;

-- 只恢复 000131 的普通部分索引形态，不删除双列或修改任何卡数据。
DROP INDEX IF EXISTS idx_iot_card_iccid_19;
DROP INDEX IF EXISTS idx_iot_card_iccid_20;

CREATE INDEX idx_iot_card_iccid_19
    ON tb_iot_card (iccid_19)
    WHERE deleted_at IS NULL;

CREATE INDEX idx_iot_card_iccid_20
    ON tb_iot_card (iccid_20)
    WHERE deleted_at IS NULL AND iccid_20 IS NOT NULL;

COMMENT ON INDEX idx_iot_card_iccid_19 IS '未删除卡的19位ICCID普通查询索引';
COMMENT ON INDEX idx_iot_card_iccid_20 IS '未删除卡的非空20位ICCID普通查询索引';

COMMIT;
