gpt4 book ai didi

postgresql - 更新我的gitlab,数据库迁移失败

转载 作者:行者123 更新时间:2023-11-29 13:22:17 25 4
gpt4 key购买 nike

我正在尝试更新我的 gitlab 版本。虽然,我正在关注这个 update

我目前在第 5 步,db migrate 命令:

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

我在运行命令时出现此错误:

== 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)

正如错误所说,我尝试启用 pg_trgp 扩展,所以我尝试了这个 tutorial .我已经安装了 postgresql-contrib,以 postgres 用户身份登录并运行命令:

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

然后我得到了这个错误:

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

我也尝试了用户 git,我的 gitlab 用户,但得到了同样的错误。

运行的操作系统是 ubuntu 16.04 LTS,一个重要的事情是/usr/share/postgres 中有两个 postgres 文件夹,9.3 和 9.5。在 9.5/extension 中存在 pg_trgm.control 文件。

我该怎么做才能让它发挥作用?

谢谢

最佳答案

看起来你必须为 PostgreSQL 9.3 安装包 postgresql-contrib,尝试以下命令:apt-get install postgresql-contrib,同时检查版本包含 apt-cache show postgresql-contrib 的包。如果不是9.3,按照这个instruction为 Ubuntu 添加 PostgreSQL 存储库并运行 apt-get updateapt-get install postgresql-contrib-9.3

关于postgresql - 更新我的gitlab,数据库迁移失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39559067/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com