【问题标题】:Gitlab CI gives 500, ERROR: relation "sessions" does not existGitlab CI 给出 ​​500,错误:关系“会话”不存在
【发布时间】:2015-02-04 07:39:52
【问题描述】:

所以我使用综合包将 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 上运行它。

【问题讨论】:

    标签: gitlab gitlab-ci


    【解决方案1】:

    要么您尚未迁移数据库 (rake db:migrate),要么您已迁移并且您的代码正在使用不存在的数据库表。

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

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

    【讨论】:

    • gitlab 的文档有点乱,但你是对的:gitlab-ci-rake db:migrate 成功了
    • 不错!所以@Tebro,你能把我的答案标记为正确的解决方案吗?谢谢!
    • 当然,只需要等待计时器用完;)
    【解决方案2】:

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

    除此之外,我们虔诚地关注manual update guides,因为它们包含了到目前为止我们需要的每一个步骤(我们不使用omnibus)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-04-17
      • 1970-01-01
      • 1970-01-01
      • 2016-10-14
      • 2019-06-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多