Content
Error upgrading from 7.3.2 to 7.4.3
Hi,
I just tried to upgrade from 7.3.2 to 7.4.3 and the following error appears.
I am running OP over MySQL and Apache web server
== 20171106074835 MoveHashedTokenToCore: migrating ============================ -- rename_table(:tokens, :plaintext_tokens) rake aborted! StandardError: An error has occurred, this and all later migrations canceled: PG::UndefinedTable: ERROR: relation "tokens_pkey" does not exist : ALTER INDEX "tokens_pkey" RENAME TO "plaintext_tokens_pkey"
Hi Nicholas,
you write you’re using a MySQL installation, yet the error is a PostgreSQL error. Please ensure your database connection is correct.
Best,
Oliver
Hi Oliver,
Sorry that was a mistake. I am using postgresql. I even upgraded to 9.6.
Still the error appears.
I tried even running openproject run rake db:migrate, but the same results appear.
Any suggestions?
Also somewhere along the stack trace I see the following:
/opt/openproject/db/migrate/20171106074835_move_hashed_token_to_core.rb:7:in `up'
The error is that you are missing the tokens table from before the migration. I cannot fathom how you got into that state. The migration tries to rename the tokens table to plaintext_tokens and fails to do so.
Can you check what tables exist before that migration by running psql -d <your database> -c "SELECT * FROM pg_catalog.pg_tables;" ?
Best,
Oliver
schemaname | tablename | tableowner | tablespace | hasindexes | hasrules | hastriggers | rowsecurity --------------------+-----------------------------------+-------------+------------+------------+----------+-------------+------------- openproject | announcements | openproject | | t | f | f | f openproject | ar_internal_metadata | openproject | | t | f | f | f openproject | attachable_journals | openproject | | t | f | f | f openproject | attachment_journals | openproject | | t | f | f | f openproject | attachments | openproject | | t | f | f | f openproject | attribute_help_texts | openproject | | t | f | f | f openproject | auth_sources | openproject | | t | f | f | f openproject | available_project_statuses | openproject | | t | f | f | f openproject | boards | openproject | | t | f | f | f openproject | categories | openproject | | t | f | f | f openproject | changes | openproject | | t | f | f | f pg_catalog | pg_statistic | postgres | | t | f | f | f pg_catalog | pg_type | postgres | | t | f | f | f openproject | changeset_journals | openproject | | t | f | f | f openproject | changesets | openproject | | t | f | f | f openproject | changesets_work_packages | openproject | | t | f | f | f openproject | comments | openproject | | t | f | f | f openproject | cost_entries | openproject | | t | f | f | f pg_catalog | pg_authid | postgres | pg_global | t | f | f | f openproject | cost_object_journals | openproject | | t | f | f | f openproject | cost_objects | openproject | | t | f | f | f openproject | cost_queries | openproject | | t | f | f | f openproject | cost_types | openproject | | t | f | f | f openproject | custom_fields | openproject | | t | f | f | f openproject | custom_fields_projects | openproject | | t | f | f | f openproject | custom_fields_types | openproject | | t | f | f | f openproject | custom_options | openproject | | t | f | f | f openproject | custom_styles | openproject | | t | f | f | f openproject | custom_values | openproject | | t | f | f | f openproject | customizable_journals | openproject | | t | f | f | f openproject | delayed_jobs | openproject | | t | f | f | f openproject | design_colors | openproject | | t | f | f | f pg_catalog | pg_user_mapping | postgres | | t | f | f | f openproject | document_journals | openproject | | t | f | f | f pg_catalog | pg_attribute | postgres | | t | f | f | f pg_catalog | pg_proc | postgres | | t | f | f | f pg_catalog | pg_class | postgres | | t | f | f | f pg_catalog | pg_attrdef | postgres | | t | f | f | f pg_catalog | pg_constraint | postgres | | t | f | f | f pg_catalog | pg_inherits | postgres | | t | f | f | f pg_catalog | pg_index | postgres | | t | f | f | f pg_catalog | pg_operator | postgres | | t | f | f | f pg_catalog | pg_opfamily | postgres | | t | f | f | f pg_catalog | pg_opclass | postgres | | t | f | f | f pg_catalog | pg_am | postgres | | t | f | f | f pg_catalog | pg_amop | postgres | | t | f | f | f pg_catalog | pg_amproc | postgres | | t | f | f | f pg_catalog | pg_language | postgres | | t | f | f | f pg_catalog | pg_largeobject_metadata | postgres | | t | f | f | f pg_catalog | pg_aggregate | postgres | | t | f | f | f pg_catalog | pg_rewrite | postgres | | t | f | f | f pg_catalog | pg_largeobject | postgres | | t | f | f | f openproject | documents | openproject | | t | f | f | f openproject | done_statuses_for_project | openproject | | f | f | f | f openproject | enabled_modules | openproject | | t | f | f | f pg_catalog | pg_trigger | postgres | | t | f | f | f pg_catalog | pg_event_trigger | postgres | | t | f | f | f pg_catalog | pg_description | postgres | | t | f | f | f pg_catalog | pg_cast | postgres | | t | f | f | f pg_catalog | pg_enum | postgres | | t | f | f | f pg_catalog | pg_namespace | postgres | | t | f | f | f pg_catalog | pg_conversion | postgres | | t | f | f | f pg_catalog | pg_depend | postgres | | t | f | f | f pg_catalog | pg_database | postgres | pg_global | t | f | f | f pg_catalog | pg_db_role_setting | postgres | pg_global | t | f | f | f pg_catalog | pg_tablespace | postgres | pg_global | t | f | f | f pg_catalog | pg_pltemplate | postgres | pg_global | t | f | f | f pg_catalog | pg_auth_members | postgres | pg_global | t | f | f | f pg_catalog | pg_shdepend | postgres | pg_global | t | f | f | f pg_catalog | pg_shdescription | postgres | pg_global | t | f | f | f pg_catalog | pg_ts_config | postgres | | t | f | f | f pg_catalog | pg_ts_config_map | postgres | | t | f | f | f pg_catalog | pg_ts_dict | postgres | | t | f | f | f pg_catalog | pg_ts_parser | postgres | | t | f | f | f pg_catalog | pg_ts_template | postgres | | t | f | f | f pg_catalog | pg_extension | postgres | | t | f | f | f pg_catalog | pg_foreign_data_wrapper | postgres | | t | f | f | f pg_catalog | pg_foreign_server | postgres | | t | f | f | f pg_catalog | pg_foreign_table | postgres | | t | f | f | f pg_catalog | pg_policy | postgres | | t | f | f | f pg_catalog | pg_replication_origin | postgres | pg_global | t | f | f | f pg_catalog | pg_default_acl | postgres | | t | f | f | f pg_catalog | pg_init_privs | postgres | | t | f | f | f pg_catalog | pg_seclabel | postgres | | t | f | f | f pg_catalog | pg_shseclabel | postgres | pg_global | t | f | f | f pg_catalog | pg_collation | postgres | | t | f | f | f pg_catalog | pg_range | postgres | | t | f | f | f pg_catalog | pg_transform | postgres | | t | f | f | f information_schema | sql_features | postgres | | f | f | f | f information_schema | sql_implementation_info | postgres | | f | f | f | f information_schema | sql_languages | postgres | | f | f | f | f information_schema | sql_packages | postgres | | f | f | f | f information_schema | sql_parts | postgres | | f | f | f | f information_schema | sql_sizing | postgres | | f | f | f | f information_schema | sql_sizing_profiles | postgres | | f | f | f | f openproject | enterprise_tokens | openproject | | t | f | f | f openproject | enumerations | openproject | | t | f | f | f openproject | export_card_configurations | openproject | | t | f | f | f openproject | group_users | openproject | | t | f | f | f openproject | journals | openproject | | t | f | f | f openproject | labor_budget_items | openproject | | t | f | f | f openproject | material_budget_items | openproject | | t | f | f | f openproject | meeting_content_journals | openproject | | t | f | f | f openproject | meeting_contents | openproject | | t | f | f | f openproject | meeting_journals | openproject | | t | f | f | f openproject | meeting_participants | openproject | | t | f | f | f openproject | meetings | openproject | | t | f | f | f openproject | member_roles | openproject | | t | f | f | f openproject | members | openproject | | t | f | f | f openproject | menu_items | openproject | | t | f | f | f openproject | message_journals | openproject | | t | f | f | f openproject | messages | openproject | | t | f | f | f openproject | my_projects_overviews | openproject | | t | f | f | f openproject | news | openproject | | t | f | f | f openproject | news_journals | openproject | | t | f | f | f openproject | planning_element_type_colors | openproject | | t | f | f | f openproject | principal_roles | openproject | | t | f | f | f openproject | project_associations | openproject | | t | f | f | f openproject | project_types | openproject | | t | f | f | f openproject | projects | openproject | | t | f | f | f openproject | projects_types | openproject | | t | f | f | f openproject | queries | openproject | | t | f | f | f openproject | rates | openproject | | t | f | f | f openproject | relations | openproject | | t | f | f | f openproject | reportings | openproject | | t | f | f | f openproject | repositories | openproject | | t | f | f | f openproject | role_permissions | openproject | | t | f | f | f openproject | roles | openproject | | t | f | f | f openproject | schema_migrations | openproject | | t | f | f | f openproject | sessions | openproject | | t | f | f | f openproject | settings | openproject | | t | f | f | f openproject | statuses | openproject | | t | f | f | f openproject | time_entries | openproject | | t | f | f | f openproject | time_entry_journals | openproject | | t | f | f | f openproject | timelines | openproject | | t | f | f | f openproject | tokens | openproject | | t | f | f | f openproject | types | openproject | | t | f | f | f openproject | user_passwords | openproject | | t | f | f | f openproject | user_preferences | openproject | | t | f | f | f openproject | version_settings | openproject | | t | f | f | f openproject | versions | openproject | | t | f | f | f openproject | watchers | openproject | | t | f | f | f openproject | wiki_content_journals | openproject | | t | f | f | f openproject | wiki_content_versions | openproject | | t | f | f | f openproject | wiki_contents | openproject | | t | f | f | f openproject | wiki_pages | openproject | | t | f | f | f openproject | wiki_redirects | openproject | | t | f | f | f openproject | wikis | openproject | | t | f | f | f openproject | work_package_journals | openproject | | t | f | f | f openproject | work_packages | openproject | | t | f | f | f openproject | workflows | openproject | | t | f | f | f openproject | users | openproject | | t | f | t | f openproject | two_factor_authentication_devices | openproject | | t | f | t | f
The tokens_pkey index was missing.
Fixed by running the following in psql
create index tokens_pkey ON tokens(id);