-- +goose Up
DECLARE
    v_count NUMBER;
BEGIN
    SELECT COUNT(*) INTO v_count
      FROM USER_INDEXES
     WHERE INDEX_NAME = 'IDX_FLASH_PERDAS_01';

    IF v_count = 0 THEN
        EXECUTE IMMEDIATE 'CREATE INDEX IDX_FLASH_PERDAS_01
            ON TB_FLASH_PERDAS (NUMERO_LOJA, DATA_PERDA)';
    END IF;
END;
/

-- +goose Down
DECLARE
    v_count NUMBER;
BEGIN
    SELECT COUNT(*) INTO v_count
      FROM USER_INDEXES
     WHERE INDEX_NAME = 'IDX_FLASH_PERDAS_01';

    IF v_count > 0 THEN
        EXECUTE IMMEDIATE 'DROP INDEX IDX_FLASH_PERDAS_01';
    END IF;
END;
/