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

Failed with: role "public_readonly" does not exist #205

Closed kulame closed 2 years ago

kulame commented 2 years ago
❯ 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-03-29-183641-readonly_role
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
Running migration 2021-11-09-191400_timeout_for_public_readonly
Executing migration script /srv/lib/near-indexer-for-explorer/migrations/2021-11-09-191400_timeout_for_public_readonly/up.sql
Failed with: role "public_readonly" does not exist
telezhnaya commented 2 years ago

Hmm, interesting.

Running migration 2021-03-29-183641-readonly_role

Gave no error. The SQL of needed migration is here https://github.com/near/near-indexer-for-explorer/blob/master/migrations/2021-03-29-183641-readonly_role/up.sql

The easiest hotfix: run SQL from this migration manually, then re-run diesel migration run

DDeAlmeida commented 2 years ago

This is due to your user who is not existing

You have to do (Change YourPassword):

CREATE USER public_readonly with password 'YourPassword'; GRANT SELECT ON ALL TABLES IN SCHEMA public TO public_readonly;

frol commented 2 years ago

@DDeAlmeida That is the catch! We never created public_readonly within migrations or other instructions, so it is not fair to add this migration in the first place.

@telezhnaya I feel we should move the tweak for public_readonly user timeout from migration to README (remove migration)

telezhnaya commented 2 years ago

@frol maybe we want the opposite action? Remove user in DB Add all the needed commands to the migration (now, part of them are only in readme) Apply migration (optional) remove this section from readme

mieubrisse commented 2 years ago

@telezhnaya This still seems to be broken, but in a different place:

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

Executing migration script /near/indexer-explorer/migrations/2021-06-09-102523_grant_select_on_new_tables/up.sql

Failed with: role "readonly" does not exist