From a2c98550b7a89858d0ca5a6cf0c3f8f8cb3ee788 Mon Sep 17 00:00:00 2001 From: i-norden Date: Mon, 10 Jan 2022 12:06:13 -0600 Subject: [PATCH] mig to upgrade schema version in db; mig to remove temporary indexes for logTrie fix --- db/migrations/00018_update_db_version.sql | 6 +++--- .../00017_update_db_version.sql | 8 ++++++++ ...s_indexes.sql => 00018_create_log_indexes.sql} | 0 .../00019_remove_log_indexes.sql | 15 +++++++++++++++ ...raints.sql => 00020_create_pk_constraints.sql} | 0 ...es_logged.sql => 00021_make_tables_logged.sql} | 0 ...elations.sql => 00022_create_fk_relations.sql} | 0 ...sql => 00023_create_postgraphile_comments.sql} | 0 ...d_indexes.sql => 00024_create_cid_indexes.sql} | 0 ...ions.sql => 00025_create_stored_functions.sql} | 0 ...sql => 00026_create_postgraphile_triggers.sql} | 0 11 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 db/post_batch_processing_migrations/00017_update_db_version.sql rename db/post_batch_processing_migrations/{00017_create_logs_indexes.sql => 00018_create_log_indexes.sql} (100%) create mode 100644 db/post_batch_processing_migrations/00019_remove_log_indexes.sql rename db/post_batch_processing_migrations/{00018_create_pk_constraints.sql => 00020_create_pk_constraints.sql} (100%) rename db/post_batch_processing_migrations/{00019_make_tables_logged.sql => 00021_make_tables_logged.sql} (100%) rename db/post_batch_processing_migrations/{00020_create_fk_relations.sql => 00022_create_fk_relations.sql} (100%) rename db/post_batch_processing_migrations/{00021_create_postgraphile_comments.sql => 00023_create_postgraphile_comments.sql} (100%) rename db/post_batch_processing_migrations/{00022_create_cid_indexes.sql => 00024_create_cid_indexes.sql} (100%) rename db/post_batch_processing_migrations/{00023_create_stored_functions.sql => 00025_create_stored_functions.sql} (100%) rename db/post_batch_processing_migrations/{00024_create_postgraphile_triggers.sql => 00026_create_postgraphile_triggers.sql} (100%) diff --git a/db/migrations/00018_update_db_version.sql b/db/migrations/00018_update_db_version.sql index 116acd9..7b27829 100644 --- a/db/migrations/00018_update_db_version.sql +++ b/db/migrations/00018_update_db_version.sql @@ -1,6 +1,6 @@ -- +goose Up -INSERT INTO public.db_version (singleton, version) VALUES (true, 'v0.3.2') -ON CONFLICT (singleton) DO UPDATE SET (version, tstamp) = ('v0.3.2', NOW()); +INSERT INTO public.db_version (singleton, version) VALUES (true, 'v3.0.0') +ON CONFLICT (singleton) DO UPDATE SET (version, tstamp) = ('v3.0.0', NOW()); -- +goose Down -DELETE FROM public.db_version WHERE version = 'v0.3.2'; +DELETE FROM public.db_version WHERE version = 'v3.0.0'; diff --git a/db/post_batch_processing_migrations/00017_update_db_version.sql b/db/post_batch_processing_migrations/00017_update_db_version.sql new file mode 100644 index 0000000..f969943 --- /dev/null +++ b/db/post_batch_processing_migrations/00017_update_db_version.sql @@ -0,0 +1,8 @@ +-- +goose Up +INSERT INTO public.db_version (singleton, version) VALUES (true, 'v3.0.0') +ON CONFLICT (singleton) DO UPDATE SET (version, tstamp) = ('v3.0.0', NOW()); + +-- +goose Down +DELETE FROM public.db_version WHERE version = 'v3.0.0'; +INSERT INTO public.db_version (singleton, version) VALUES (true, 'v0.3.2') +ON CONFLICT (singleton) DO UPDATE SET (version, tstamp) = ('v0.3.2', NOW()); diff --git a/db/post_batch_processing_migrations/00017_create_logs_indexes.sql b/db/post_batch_processing_migrations/00018_create_log_indexes.sql similarity index 100% rename from db/post_batch_processing_migrations/00017_create_logs_indexes.sql rename to db/post_batch_processing_migrations/00018_create_log_indexes.sql diff --git a/db/post_batch_processing_migrations/00019_remove_log_indexes.sql b/db/post_batch_processing_migrations/00019_remove_log_indexes.sql new file mode 100644 index 0000000..3bd4b8f --- /dev/null +++ b/db/post_batch_processing_migrations/00019_remove_log_indexes.sql @@ -0,0 +1,15 @@ +-- +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); diff --git a/db/post_batch_processing_migrations/00018_create_pk_constraints.sql b/db/post_batch_processing_migrations/00020_create_pk_constraints.sql similarity index 100% rename from db/post_batch_processing_migrations/00018_create_pk_constraints.sql rename to db/post_batch_processing_migrations/00020_create_pk_constraints.sql diff --git a/db/post_batch_processing_migrations/00019_make_tables_logged.sql b/db/post_batch_processing_migrations/00021_make_tables_logged.sql similarity index 100% rename from db/post_batch_processing_migrations/00019_make_tables_logged.sql rename to db/post_batch_processing_migrations/00021_make_tables_logged.sql diff --git a/db/post_batch_processing_migrations/00020_create_fk_relations.sql b/db/post_batch_processing_migrations/00022_create_fk_relations.sql similarity index 100% rename from db/post_batch_processing_migrations/00020_create_fk_relations.sql rename to db/post_batch_processing_migrations/00022_create_fk_relations.sql diff --git a/db/post_batch_processing_migrations/00021_create_postgraphile_comments.sql b/db/post_batch_processing_migrations/00023_create_postgraphile_comments.sql similarity index 100% rename from db/post_batch_processing_migrations/00021_create_postgraphile_comments.sql rename to db/post_batch_processing_migrations/00023_create_postgraphile_comments.sql diff --git a/db/post_batch_processing_migrations/00022_create_cid_indexes.sql b/db/post_batch_processing_migrations/00024_create_cid_indexes.sql similarity index 100% rename from db/post_batch_processing_migrations/00022_create_cid_indexes.sql rename to db/post_batch_processing_migrations/00024_create_cid_indexes.sql diff --git a/db/post_batch_processing_migrations/00023_create_stored_functions.sql b/db/post_batch_processing_migrations/00025_create_stored_functions.sql similarity index 100% rename from db/post_batch_processing_migrations/00023_create_stored_functions.sql rename to db/post_batch_processing_migrations/00025_create_stored_functions.sql diff --git a/db/post_batch_processing_migrations/00024_create_postgraphile_triggers.sql b/db/post_batch_processing_migrations/00026_create_postgraphile_triggers.sql similarity index 100% rename from db/post_batch_processing_migrations/00024_create_postgraphile_triggers.sql rename to db/post_batch_processing_migrations/00026_create_postgraphile_triggers.sql