Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c4254bdff1 | ||
|
|
1088313ab7 | ||
|
|
ffdf0a0d4d | ||
|
|
edabfcc9c9 | ||
|
|
6612edabbe | ||
|
|
ae1a6e9d31 |
@@ -57,13 +57,11 @@ rollback_to: $(GOOSE) checkmigration checkdbvars
|
||||
.PHONY: `rollback_pre_batch_set`
|
||||
rollback_pre_batch_set: $(GOOSE) checkdbvars
|
||||
$(GOOSE) -dir db/pre_batch_processing_migrations postgres "$(CONNECT_STRING)" down
|
||||
pg_dump -O -s $(CONNECT_STRING) > schema.sql
|
||||
|
||||
## Rollback post_batch_set
|
||||
.PHONY: rollback_post_batch_set
|
||||
rollback_post_batch_set: $(GOOSE) checkdbvars
|
||||
$(GOOSE) -dir db/post_batch_processing_migrations postgres "$(CONNECT_STRING)" down
|
||||
pg_dump -O -s $(CONNECT_STRING) > schema.sql
|
||||
|
||||
## Apply the next up migration
|
||||
.PHONY: migrate_up_by_one
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
-- +goose Up
|
||||
CREATE INDEX log_mh_index_index ON eth.log_cids USING btree (leaf_mh_key);
|
||||
CREATE INDEX log_mh_index ON eth.log_cids USING btree (leaf_mh_key);
|
||||
CREATE INDEX block_number_index ON eth.header_cids USING brin (block_number);
|
||||
CREATE INDEX header_hash_index ON eth.header_cids USING btree (block_hash);
|
||||
CREATE INDEX tx_header_hash_index ON eth.transaction_cids USING btree (header_id);
|
||||
CREATE INDEX transaction_hash_index ON eth.transaction_cids USING btree (tx_hash);
|
||||
CREATE INDEX log_tx_hash_index ON eth.log_cids USING btree (rct_id);
|
||||
CREATE INDEX header_block_hash_index ON eth.header_cids USING btree (block_hash);
|
||||
CREATE INDEX tx_header_id_index ON eth.transaction_cids USING btree (header_id);
|
||||
CREATE INDEX tx_tx_hash_index ON eth.transaction_cids USING btree (tx_hash);
|
||||
CREATE INDEX log_cids_index ON eth.log_cids USING btree (rct_id, index);
|
||||
|
||||
-- +goose Down
|
||||
DROP INDEX eth.log_tx_hash_index;
|
||||
DROP INDEX eth.transaction_hash_index;
|
||||
DROP INDEX eth.tx_header_hash_index;
|
||||
DROP INDEX eth.header_hash_index;
|
||||
DROP INDEX eth.log_cids_index;
|
||||
DROP INDEX eth.tx_tx_hash_index;
|
||||
DROP INDEX eth.tx_header_id_index;
|
||||
DROP INDEX eth.header_block_hash_index;
|
||||
DROP INDEX eth.block_number_index;
|
||||
DROP INDEX eth.log_mh_index_index;
|
||||
DROP INDEX eth.log_mh_index;
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
-- +goose Up
|
||||
ALTER TABLE eth.log_cids
|
||||
ADD CONSTRAINT fk_log_leaf_mh_key
|
||||
FOREIGN KEY (leaf_mh_key) REFERENCES public.blocks (key)
|
||||
ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
|
||||
|
||||
-- +goose Down
|
||||
ALTER TABLE eth.log_cids
|
||||
DROP CONSTRAINT fk_log_leaf_mh_key;
|
||||
@@ -1,15 +0,0 @@
|
||||
-- +goose Up
|
||||
DROP INDEX eth.log_tx_hash_index;
|
||||
DROP INDEX eth.transaction_hash_index;
|
||||
DROP INDEX eth.tx_header_hash_index;
|
||||
DROP INDEX eth.header_hash_index;
|
||||
DROP INDEX eth.block_number_index;
|
||||
DROP INDEX eth.log_mh_index_index;
|
||||
|
||||
-- +goose Down
|
||||
CREATE INDEX log_mh_index_index ON eth.log_cids USING btree (leaf_mh_key);
|
||||
CREATE INDEX block_number_index ON eth.header_cids USING brin (block_number);
|
||||
CREATE INDEX header_hash_index ON eth.header_cids USING btree (block_hash);
|
||||
CREATE INDEX tx_header_hash_index ON eth.transaction_cids USING btree (header_id);
|
||||
CREATE INDEX transaction_hash_index ON eth.transaction_cids USING btree (tx_hash);
|
||||
CREATE INDEX log_tx_hash_index ON eth.log_cids USING btree (rct_id);
|
||||
@@ -0,0 +1,53 @@
|
||||
-- +goose Up
|
||||
UPDATE pg_index
|
||||
SET indisready=false
|
||||
WHERE indrelid = (
|
||||
SELECT oid
|
||||
FROM pg_class
|
||||
WHERE relname='eth.log_cids'
|
||||
);
|
||||
UPDATE pg_index
|
||||
SET indisready=false
|
||||
WHERE indrelid = (
|
||||
SELECT oid
|
||||
FROM pg_class
|
||||
WHERE relname='eth.transaction_cids'
|
||||
);
|
||||
UPDATE pg_index
|
||||
SET indisready=false
|
||||
WHERE indrelid = (
|
||||
SELECT oid
|
||||
FROM pg_class
|
||||
WHERE relname='eth.header_cids'
|
||||
);
|
||||
|
||||
ALTER TABLE eth.log_cids
|
||||
DROP CONSTRAINT fk_log_leaf_mh_key;
|
||||
|
||||
-- +goose Down
|
||||
ALTER TABLE eth.log_cids
|
||||
ADD CONSTRAINT fk_log_leaf_mh_key
|
||||
FOREIGN KEY (leaf_mh_key) REFERENCES public.blocks (key)
|
||||
ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
|
||||
|
||||
UPDATE pg_index
|
||||
SET indisready=true
|
||||
WHERE indrelid = (
|
||||
SELECT oid
|
||||
FROM pg_class
|
||||
WHERE relname='eth.header_cids'
|
||||
);
|
||||
UPDATE pg_index
|
||||
SET indisready=true
|
||||
WHERE indrelid = (
|
||||
SELECT oid
|
||||
FROM pg_class
|
||||
WHERE relname='eth.transaction_cids'
|
||||
);
|
||||
UPDATE pg_index
|
||||
SET indisready=true
|
||||
WHERE indrelid = (
|
||||
SELECT oid
|
||||
FROM pg_class
|
||||
WHERE relname='eth.log_cids'
|
||||
);
|
||||
@@ -0,0 +1,53 @@
|
||||
-- +goose Up
|
||||
UPDATE pg_index
|
||||
SET indisready=true
|
||||
WHERE indrelid = (
|
||||
SELECT oid
|
||||
FROM pg_class
|
||||
WHERE relname='eth.header_cids'
|
||||
);
|
||||
UPDATE pg_index
|
||||
SET indisready=true
|
||||
WHERE indrelid = (
|
||||
SELECT oid
|
||||
FROM pg_class
|
||||
WHERE relname='eth.transaction_cids'
|
||||
);
|
||||
UPDATE pg_index
|
||||
SET indisready=true
|
||||
WHERE indrelid = (
|
||||
SELECT oid
|
||||
FROM pg_class
|
||||
WHERE relname='eth.log_cids'
|
||||
);
|
||||
|
||||
DROP INDEX eth.tx_header_id_index;
|
||||
DROP INDEX eth.block_number_index;
|
||||
DROP INDEX eth.log_mh_index;
|
||||
|
||||
-- +goose Down
|
||||
CREATE INDEX log_mh_index ON eth.log_cids USING btree (leaf_mh_key);
|
||||
CREATE INDEX block_number_index ON eth.header_cids USING brin (block_number);
|
||||
CREATE INDEX tx_header_id_index ON eth.transaction_cids USING btree (header_id);
|
||||
|
||||
UPDATE pg_index
|
||||
SET indisready=false
|
||||
WHERE indrelid = (
|
||||
SELECT oid
|
||||
FROM pg_class
|
||||
WHERE relname='eth.log_cids'
|
||||
);
|
||||
UPDATE pg_index
|
||||
SET indisready=false
|
||||
WHERE indrelid = (
|
||||
SELECT oid
|
||||
FROM pg_class
|
||||
WHERE relname='eth.transaction_cids'
|
||||
);
|
||||
UPDATE pg_index
|
||||
SET indisready=false
|
||||
WHERE indrelid = (
|
||||
SELECT oid
|
||||
FROM pg_class
|
||||
WHERE relname='eth.header_cids'
|
||||
);
|
||||
+2
-2
@@ -46,8 +46,8 @@ CREATE INDEX access_list_element_address_index ON eth.access_list_elements USING
|
||||
CREATE INDEX access_list_storage_keys_index ON eth.access_list_elements USING gin (storage_keys);
|
||||
|
||||
-- log indexes
|
||||
CREATE INDEX log_mh_index ON eth.log_cids USING btree (leaf_mh_key);
|
||||
CREATE INDEX log_cid_index ON eth.log_cids USING btree (leaf_cid);
|
||||
CREATE INDEX log_mh_index ON eth.log_cids USING btree (leaf_mh_key);
|
||||
CREATE INDEX log_address_index ON eth.log_cids USING btree (address);
|
||||
CREATE INDEX log_topic0_index ON eth.log_cids USING btree (topic0);
|
||||
CREATE INDEX log_topic1_index ON eth.log_cids USING btree (topic1);
|
||||
@@ -61,8 +61,8 @@ DROP INDEX eth.log_topic2_index;
|
||||
DROP INDEX eth.log_topic1_index;
|
||||
DROP INDEX eth.log_topic0_index;
|
||||
DROP INDEX eth.log_address_index;
|
||||
DROP INDEX eth.log_cid_index;
|
||||
DROP INDEX eth.log_mh_index;
|
||||
DROP INDEX eth.log_cid_index;
|
||||
|
||||
-- access list indexes
|
||||
DROP INDEX eth.access_list_storage_keys_index;
|
||||
Reference in New Issue
Block a user