Gitlab CI gives 500, ERROR: relation "sessions" does not exist

Gitlab CI gives 500, ERROR: relation "sessions" does not exist

所以我使用 omnibus 包将 Gitlab 从 7.1.1 升级到 7.7.2。

升级后我决定尝试 Gitlab CI 并将 ci_external_url 行添加到 /etc/gitlab/gitlab.rb,但是当我浏览到定义的 URL 我收到 500 错误并且日志输出以下内容:

Started GET "/" for 1.3.3.7 at 2015-02-04 09:14:35 +0200
Processing by ProjectsController#index as HTML
PG::UndefinedTable: ERROR:  relation "sessions" does not exist
LINE 5:                WHERE a.attrelid = '"sessions"'::regclass
                                          ^
:               SELECT a.attname, format_type(a.atttypid, a.atttypmod),
                     pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
                FROM pg_attribute a LEFT JOIN pg_attrdef d
                  ON a.attrelid = d.adrelid AND a.attnum = d.adnum
               WHERE a.attrelid = '"sessions"'::regclass
                 AND a.attnum > 0 AND NOT a.attisdropped
               ORDER BY a.attnum

Redirected to 
Completed 500 Internal Server Error in 5ms

ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR:  relation "sessions" does not exist
LINE 5:                WHERE a.attrelid = '"sessions"'::regclass
                                          ^
:               SELECT a.attname, format_type(a.atttypid, a.atttypmod),
                     pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
                FROM pg_attribute a LEFT JOIN pg_attrdef d
                  ON a.attrelid = d.adrelid AND a.attnum = d.adnum
               WHERE a.attrelid = '"sessions"'::regclass
                 AND a.attnum > 0 AND NOT a.attisdropped
               ORDER BY a.attnum
):
  app/controllers/application_controller.rb:76:in `check_config'

我在 Debian 7 上 运行。

您尚未迁移数据库 (rake db:migrate),或者您已经迁移但您的代码使用的数据库 table 不存在。

尝试迁移看看是否能解决您的问题。

更新:对于有同样问题的其他人,Gitlab 的命令似乎是 gitlab-ci-rake db:migrate

我发现综合信息检查 sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production 是 gitlab 中最有用的命令。它可以突出显示您可以 运行 在更新过程中遇到的许多问题。除了常规权限问题外,它还会识别丢失的数据库更新。

除此之外,我们虔诚地遵循 manual update guides,因为它们包含到目前为止我们需要的每一步(我们不使用综合)。