user2858691
user2858691

Reputation: 125

Updating my gitlab, database migration fails

I am trying to update my gitlab version. Though, I am following this update

I am currently at step 5, the db migrate command :

sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production

I have this error running the command:

== 20160226114608 AddTrigramIndexesForSearching: migrating     ====================
-- enable_extension("pg_trgm")
-- execute("SELECT true AS enabled FROM pg_available_extensions WHERE     name = 'pg_trgm' AND installed_version IS NOT NULL;")
   -> 0.0225s
rake aborted!
StandardError: An error has occurred, all later migrations canceled:

You must enable the pg_trgm extension. You can do so by running "CREATE EXTENSION pg_trgm;" as a PostgreSQL super user, this must be done for every GitLab database. For more information see http://www.postgresql.org    /docs/current/static/sql-createextension.html/home/git/gitlab/db/migrate/20160226114608_add_trigram_indexes_for_searching.rb:11:in `up'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activerecord-4.2.7.1/lib/active_record/migration.rb:611:in `exec_migration'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activerecord-4.2.7.1/lib/active_record/migration.rb:592:in `block (2 levels) in migrate'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activerecord-4.2.7.1/lib/active_record/migration.rb:591:in `block in migrate'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activerecord-4.2.7.1/lib/active_record/migration.rb:590:in `migrate'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activerecord-4.2.7.1/lib/active_record/migration.rb:768:in `migrate'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activerecord-4.2.7.1/lib/active_record/migration.rb:998:in `block in execute_migration_in_transaction'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activerecord-4.2.7.1/lib/active_record/migration.rb:1046:in `ddl_transaction'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activerecord-4.2.7.1/lib/active_record/migration.rb:997:in `execute_migration_in_transaction'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activerecord-4.2.7.1/lib/active_record/migration.rb:959:in `block in migrate'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activerecord-4.2.7.1/lib/active_record/migration.rb:955:in `each'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activerecord-4.2.7.1/lib/active_record/migration.rb:955:in `migrate'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activerecord-4.2.7.1/lib/active_record/migration.rb:823:in `up'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activerecord-4.2.7.1/lib/active_record/migration.rb:801:in `migrate'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activerecord-4.2.7.1/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activerecord-4.2.7.1/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
You must enable the pg_trgm extension. You can do so by running "CREATE EXTENSION pg_trgm;" as a PostgreSQL super user, this must be done for every GitLab database. For more information see http://www.postgresql.org/docs/current/static/sql-createextension.html
/home/git/gitlab/db/migrate/20160226114608_add_trigram_indexes_for_searching.rb:11:in `up'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activerecord-4.2.7.1/lib/active_record/migration.rb:611:in `exec_migration'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activerecord-4.2.7.1/lib/active_record/migration.rb:592:in `block (2 levels) in migrate'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activerecord-4.2.7.1/lib/active_record/migration.rb:591:in `block in migrate'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activerecord-4.2.7.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activerecord-4.2.7.1/lib/active_record/migration.rb:590:in `migrate'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activerecord-4.2.7.1/lib/active_record/migration.rb:768:in `migrate'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activerecord-4.2.7.1/lib/active_record/migration.rb:998:in `block in execute_migration_in_transaction'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activerecord-4.2.7.1/lib/active_record/migration.rb:1046:in `ddl_transaction'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activerecord-4.2.7.1/lib/active_record/migration.rb:997:in `execute_migration_in_transaction'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activerecord-4.2.7.1/lib/active_record/migration.rb:959:in `block in migrate'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activerecord-4.2.7.1/lib/active_record/migration.rb:955:in `each'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activerecord-4.2.7.1/lib/active_record/migration.rb:955:in `migrate'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activerecord-4.2.7.1/lib/active_record/migration.rb:823:in `up'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activerecord-4.2.7.1/lib/active_record/migration.rb:801:in `migrate'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activerecord-4.2.7.1/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/activerecord-4.2.7.1/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

as the error says I tried to enable the pg_trgp extension, so i tried this tutorial. I have installed postgresql-contrib, login as postgres user and run the command :

psql -d gitlabhq_production -c "CREATE EXTENSION pg_trgm;"

Then I have got this error :

ERROR:  could not open extension control file "/usr/share/postgresql/9.3/extension/pg_trgm.control": Aucun fichier ou dossier de ce type

I also tried whith the user git, my gitlab user and got the same error.

The os running is an ubuntu 16.04 LTS, and one strgane thing is that there are two postgres folder in /usr/share/postgres, 9.3 and 9.5. In the 9.5/extension the pg_trgm.control file exists.

What can I do to make it work?

thanks

Upvotes: 1

Views: 731

Answers (1)

icuken
icuken

Reputation: 1356

Looks like you have to install package postgresql-contrib for PostgreSQL 9.3, try following command: apt-get install postgresql-contrib, but also check the version of the package with apt-cache show postgresql-contrib. If it is not 9.3, follow this instruction to add PostgreSQL repositories for Ubuntu and run apt-get update and apt-get install postgresql-contrib-9.3

Upvotes: 1

Related Questions