Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add all_ecocredit_txes function #34

Merged
merged 1 commit into from
Aug 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions sql/V1_9__all_ecocredit_txes.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
CREATE INDEX IF NOT EXISTS tx_data_tx_response_code_idx ON tx USING GIN ((DATA -> 'tx_response' -> 'code'));

CREATE INDEX IF NOT EXISTS msg_event_type_idx ON msg_event (
TYPE
);

DROP FUNCTION IF EXISTS all_ecocredit_txes;

CREATE FUNCTION all_ecocredit_txes () RETURNS SETOF tx AS $$
select tx.*
from tx
natural join msg_event as me
where
data ->'tx_response'->'code' @> '0'
and me.type like 'regen.ecocredit.%'
$$ LANGUAGE SQL STABLE;