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

Index scheduled transfer events. #324

Merged
merged 8 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions backend-rust/migrations/0001_initialize.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,36 @@ CREATE INDEX event_index_per_contract_idx ON contract_events (event_index_per_co
-- Important for quickly filtering contract events by a specific contract.
CREATE INDEX contract_events_idx ON contract_events (contract_index, contract_sub_index);

-- Every scheduled release on chain.
CREATE TABLE scheduled_releases (
-- An index/id for this scheduled release (row number).
index
BIGINT GENERATED ALWAYS AS IDENTITY
PRIMARY KEY,
-- The index of the transaction creating the scheduled transfer.
transaction_index
BIGINT
NOT NULL
REFERENCES transactions,
-- The account receiving the scheduled transfer.
account_index
BIGINT
NOT NULL
REFERENCES accounts,
-- The scheduled release time.
release_time
TIMESTAMPTZ
NOT NULL,
-- The amount locked in the scheduled release.
amount
BIGINT
NOT NULL
);

-- We typically want to find all scheduled releases for a specific account.
-- This index is useful for that.
CREATE INDEX scheduled_releases_idx ON scheduled_releases (account_index);

CREATE OR REPLACE FUNCTION block_added_notify_trigger_function() RETURNS trigger AS $trigger$
DECLARE
rec blocks;
Expand Down
Loading
Loading