near / near-indexer-for-explorer

Watch NEAR network and store all the data from NEAR blockchain to PostgreSQL database
https://near-indexers.io/docs/projects/near-indexer-for-explorer
GNU General Public License v3.0
123 stars 56 forks source link

Upgrade from 0.10.8 to 0.10.10 migrations failed #250

Closed teke97 closed 2 years ago

teke97 commented 2 years ago

Try to upgrade from 0.10.8 to 0.10.10

$ diesel migration run
Running migration 2022-01-12-100000_assets_ft
Running migration 2022-01-26-184200_index_action_receipt_actions
Running migration 2022-01-26-184200_drop_duplicated_index_execution_outcome
Failed with: duplicate key value violates unique constraint "__diesel_schema_migrations_pkey"

I think timestamps for 2022-01-26-184200_index_action_receipt_actions 2022-01-26-184200_drop_duplicated_index_execution_outcome should not be equal.

khorolets commented 2 years ago

@teke97 could you please try to rename one of the folders you suspect causing this error and ensure it might be resolved? Thanks!

teke97 commented 2 years ago

@khorolets I can confirm that this worked for me

# git status
HEAD detached at 0.10.8
nothing to commit, working tree clean
# diesel migration run
Running migration 2020-12-07-153402_initial_schema
Running migration 2021-01-14-170424_index-receipt-originated-from-transaction-hash
Running migration 2021-01-20-152056_index-transactions-receiver-account-id
Running migration 2021-03-11-123839_index-action-kind-and-status
Running migration 2021-04-22-090505_execution_outcomes_replace_chunk_relation_with_shard_id
Running migration 2021-04-28-154439_denormalize_action_receipt_actions
Running migration 2021-05-06-093622_additional_indexes_for_action_receipt_actions
Running migration 2021-05-07-115559_convert_args_base64_to_args_json
Running migration 2021-05-10-084700_indexer_on_args_field
Running migration 2021-05-27-154211_account_changes_unique_idx
Running migration 2021-06-02-173100_add_migration_state_change_reason_kind
Running migration 2021-06-09-102523_grant_select_on_new_tables
Running migration 2021-08-02-183200_transactions_sorting_idx
Running migration 2021-08-04-151515_circulating_supply_table
Running migration 2021-08-06-123500_account_changes_ordering_column
Running migration 2021-08-11-163800_account_changes_ordering_idx
Running migration 2021-10-04-100000_assets_nft
Running migration 2021-10-14-180948_add_resharding_state_change_reason_kind
# git checkout 0.10.10
Previous HEAD position was 82f4e24 refactor: Upgrade nearcore to 1.24.0-rc.1 (#230)
HEAD is now at e8c6294 refactor: Upgrade to nearcore 1.24.0-rc.3 (#249)
# mv migrations/2022-01-26-184200_index_action_receipt_actions/ migrations/2022-01-26-184201_index_action_receipt_actions/
# diesel migration run
Running migration 2022-01-12-100000_assets_ft
Running migration 2022-01-26-184200_drop_duplicated_index_execution_outcome
Running migration 2022-01-26-184201_index_action_receipt_actions
khorolets commented 2 years ago

@teke97 I invite you to open a pull request with the fix! Thanks for reporting and figuring this out!

khorolets commented 2 years ago

Resolved by #251