-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[index] current unified balances (#366)
* [index] concurrent unified balances * fixup! [index] concurrent unified balances
- Loading branch information
Showing
22 changed files
with
484 additions
and
56 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
rust/processor/migrations/2024-05-04-025823_current_unified_fungible_asset_balance/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
-- This file should undo anything in `up.sql` | ||
DROP TABLE IF EXISTS current_unified_fungible_asset_balances; | ||
DROP INDEX IF EXISTS cufab_owner_at_index; | ||
DROP INDEX IF EXISTS cufab_insat_index; |
21 changes: 21 additions & 0 deletions
21
rust/processor/migrations/2024-05-04-025823_current_unified_fungible_asset_balance/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
-- current fungible asset balances | ||
CREATE TABLE IF NOT EXISTS current_unified_fungible_asset_balances ( | ||
storage_id VARCHAR(66) PRIMARY KEY NOT NULL, | ||
owner_address VARCHAR(66) NOT NULL, | ||
asset_type VARCHAR(66) NOT NULL, | ||
coin_type VARCHAR(1000), | ||
is_primary BOOLEAN, | ||
is_frozen BOOLEAN NOT NULL, | ||
amount_v1 NUMERIC, | ||
amount_v2 NUMERIC, | ||
amount NUMERIC GENERATED ALWAYS AS (COALESCE(amount_v1, 0) + COALESCE(amount_v2, 0)) STORED, | ||
last_transaction_version_v1 BIGINT, | ||
last_transaction_version_v2 BIGINT, | ||
last_transaction_version BIGINT GENERATED ALWAYS AS (GREATEST(last_transaction_version_v1, last_transaction_version_v2)) STORED, | ||
last_transaction_timestamp_v1 TIMESTAMP, | ||
last_transaction_timestamp_v2 TIMESTAMP, | ||
last_transaction_timestamp TIMESTAMP GENERATED ALWAYS AS (GREATEST(last_transaction_timestamp_v1, last_transaction_timestamp_v2)) STORED, | ||
inserted_at TIMESTAMP NOT NULL DEFAULT NOW() | ||
); | ||
CREATE INDEX IF NOT EXISTS cufab_owner_at_index ON current_unified_fungible_asset_balances (owner_address, asset_type); | ||
CREATE INDEX IF NOT EXISTS cufab_insat_index ON current_unified_fungible_asset_balances (inserted_at); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.