-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into 10238-fix-no-state-logic-for-spam-request
- Loading branch information
Showing
59 changed files
with
6,015 additions
and
3,002 deletions.
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
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
42 changes: 42 additions & 0 deletions
42
blockexplorer/store/migrations/0005_add_block_height_to_tx_result.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,42 @@ | ||
-- +goose Up | ||
|
||
-- make the block height nullable so tendermint can still insert and the | ||
-- trigger takes over to set the value. | ||
ALTER TABLE tx_results | ||
ADD COLUMN IF NOT EXISTS block_height BIGINT DEFAULT 0; | ||
|
||
UPDATE tx_results | ||
SET block_height=b.height | ||
FROM blocks b | ||
WHERE b.rowid = tx_results.block_id; | ||
|
||
-- +goose StatementBegin | ||
CREATE OR REPLACE FUNCTION add_block_height_to_tx_results() | ||
RETURNS TRIGGER | ||
LANGUAGE plpgsql AS | ||
$$ | ||
BEGIN | ||
UPDATE tx_results | ||
SET block_height=b.height | ||
FROM blocks b | ||
WHERE b.rowid = NEW.block_id | ||
AND tx_results.rowid = NEW.rowid; | ||
|
||
RETURN NULL; | ||
END; | ||
$$; | ||
-- +goose StatementEnd | ||
|
||
CREATE TRIGGER add_block_height_to_tx_results | ||
AFTER INSERT | ||
ON tx_results | ||
FOR EACH ROW | ||
EXECUTE PROCEDURE add_block_height_to_tx_results(); | ||
|
||
-- +goose Down | ||
|
||
DROP TRIGGER IF EXISTS add_block_height_to_tx_results ON tx_results; | ||
|
||
ALTER TABLE tx_results | ||
DROP COLUMN IF EXISTS block_height; | ||
|
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.