-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #796 from econia-labs/ECO-2086
[ECO-2086] Add last_transaction_timestamp to data_status endpoint
- Loading branch information
Showing
3 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
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
23 changes: 23 additions & 0 deletions
23
.../dbv2/migrations/2024-08-14-160622_add_last_transaction_timestamp_to_data_status/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,23 @@ | ||
-- This file should undo anything in `up.sql` | ||
DROP VIEW api.data_status; | ||
|
||
CREATE VIEW api.data_status AS | ||
SELECT | ||
CURRENT_TIMESTAMP AS current_time, | ||
processor_status.last_success_version AS processor_last_txn_version_processed, | ||
user_history_last_indexed_txn.txn_version AS aggregator_user_history_last_txn_version_processed, | ||
array_agg(ARRAY[resolution, candlesticks_last_indexed_txn.txn_version]) AS aggregator_candlesticks_last_txn_version_processed | ||
FROM | ||
processor_status, | ||
aggregator.user_history_last_indexed_txn, | ||
aggregator.candlesticks_last_indexed_txn | ||
WHERE | ||
processor_status.processor = 'econia_processor' | ||
GROUP BY | ||
user_history_last_indexed_txn.txn_version, | ||
processor_status.last_success_version; | ||
|
||
|
||
GRANT | ||
SELECT | ||
ON api.data_status TO web_anon; |
25 changes: 25 additions & 0 deletions
25
...st/dbv2/migrations/2024-08-14-160622_add_last_transaction_timestamp_to_data_status/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,25 @@ | ||
-- Your SQL goes here | ||
DROP VIEW api.data_status; | ||
|
||
CREATE VIEW api.data_status AS | ||
SELECT | ||
CURRENT_TIMESTAMP AS current_time, | ||
processor_status.last_transaction_timestamp AS processor_last_txn_timestamp_processed, | ||
processor_status.last_success_version AS processor_last_txn_version_processed, | ||
user_history_last_indexed_txn.txn_version AS aggregator_user_history_last_txn_version_processed, | ||
array_agg(ARRAY[resolution, candlesticks_last_indexed_txn.txn_version]) AS aggregator_candlesticks_last_txn_version_processed | ||
FROM | ||
processor_status, | ||
aggregator.user_history_last_indexed_txn, | ||
aggregator.candlesticks_last_indexed_txn | ||
WHERE | ||
processor_status.processor = 'econia_processor' | ||
GROUP BY | ||
user_history_last_indexed_txn.txn_version, | ||
processor_status.last_success_version, | ||
processor_status.last_transaction_timestamp; | ||
|
||
|
||
GRANT | ||
SELECT | ||
ON api.data_status TO web_anon; |