将gitlab从8.5.7升级至8.6.1之后,方法有些页面出现500错误。
用 gitlab-rake db:migrate:status 命令查看,发现以下数据库迁移未成功:
down 20160226114608 Add trigram indexes for searching down 20160229193553 Add main language to repository down 20160301124843 Add visibility level to groups down 20160305220806 Remove expires at from snippets down 20160307221555 Disallow blank line code on note down 20160308212903 Add default group visibility to application settings down 20160310185910 Add external flag to users down 20160314143402 Projects add pushes since gc down 20160316123110 Ci runners token index down 20160316192622 Change target id to null on todos down 20160316204731 Add commit id to todos down 20160317092222 Add moved to to issue down 20160320204112 Index namespaces on visibility level
运行 gitlab-rake db:migrate 出现如下的错误:
== 20160226114608 AddTrigramIndexesForSearching: migrating ==================== -- execute("SELECT true AS enabled FROM pg_available_extensions WHERE name = 'pg_trgm' AND installed_version IS NOT NULL;") -> 0.0042s 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.
原来是需要安装给 PostgreSQL 安装 pg_trgm 扩展。
我们的 PostgreSQL 数据库用的是阿里云的RDS,于是登录到RDS的DMS管理控制台,在命令窗口执行 CREATE EXTENSION pg_trgm; 命令。
然后回到gitlab服务器,执行 gitlab-rake db:migrate 命令成功,问题解决。
dudu 问下 PostgreSQL怎么样啊, 相比mysql 总感觉弱了些 。
目前只是简单使用,不太了解
@dudu: 额额