-- +goose Up
-- +goose StatementBegin
CREATE OR REPLACE VIEW VW_FLASH_META_PERDA_STG AS
SELECT
    CAST(NULL AS NUMBER)        AS cod_empresa,
    CAST(NULL AS VARCHAR2(30))  AS tipo_nodo,
    CAST(NULL AS VARCHAR2(60))  AS codigo_nodo,
    CAST(NULL AS VARCHAR2(60))  AS codigo_nodo_pai,
    CAST(NULL AS VARCHAR2(30))  AS tipo_nodo_pai,
    CAST(NULL AS DATE)          AS data_referencia,
    CAST(NULL AS NUMBER(4))     AS ano_referencia,
    CAST(NULL AS NUMBER(2))     AS mes_referencia,
    CAST(NULL AS NUMBER(2))     AS dia_referencia,
    CAST(NULL AS NUMBER(10,4))  AS percentual_meta,
    CAST(NULL AS NUMBER(18,6))  AS valor_meta,
    CAST(NULL AS VARCHAR2(500)) AS observacao,
    CAST(NULL AS VARCHAR2(100)) AS origem_meta
FROM dual
WHERE 1 = 0
-- +goose StatementEnd

-- +goose Down
-- +goose StatementBegin
DECLARE
    v_count NUMBER;
BEGIN
    SELECT COUNT(*) INTO v_count FROM user_objects WHERE object_name = 'VW_FLASH_META_PERDA_STG' AND object_type = 'VIEW';
    IF v_count > 0 THEN
        EXECUTE IMMEDIATE 'DROP VIEW VW_FLASH_META_PERDA_STG';
    END IF;
END;
-- +goose StatementEnd
