diff --git a/sql/V1_10__all_ecocredit_txes.sql b/sql/V1_10__all_ecocredit_txes.sql new file mode 100644 index 0000000..8f53e54 --- /dev/null +++ b/sql/V1_10__all_ecocredit_txes.sql @@ -0,0 +1,10 @@ +DROP FUNCTION IF EXISTS all_ecocredit_txes; + +CREATE FUNCTION all_ecocredit_txes () RETURNS SETOF tx AS $$ + select tx.* + from tx + natural join msg_event_attr as mea + where + data ->'tx_response'->'code' @> '0' + and mea.type like 'regen.ecocredit%' +$$ LANGUAGE SQL STABLE; diff --git a/sql/V1_9__index_tx_response_code_and_type.sql b/sql/V1_9__index_tx_response_code_and_type.sql new file mode 100644 index 0000000..33144c7 --- /dev/null +++ b/sql/V1_9__index_tx_response_code_and_type.sql @@ -0,0 +1 @@ +CREATE INDEX IF NOT EXISTS tx_data_tx_response_code_idx ON tx USING GIN ((DATA -> 'tx_response' -> 'code'));