Error 500 on every project page after update to CE 9.4.5

Summary

After the upgrade to Gitlab CE 9.4.5 I get an error 500 on every project page. I already added the columns from https://gitlab.com/gitlab-org/gitlab-ce/issues/29332 but the error is still there.

Relevant logs and/or screenshots

ActionView::Template::Error (No route matches {:action=>"show", :controller=>"projects/tree", :id=>nil, :namespace_id=>#<Group id: 21, name: "test", path: "test", owner_id: nil, created_at: "2017-08-19 09:40:43", updated_at: "2017-08-19 09:40:43", type: "Group", description: "gitlab recovery test", avatar: nil, share_with_group_lock: false, visibility_level: 0, request_access_enabled: false, deleted_at: nil, lfs_enabled: nil, description_html: "<p dir=\"auto\">gitlab recovery test</p>", parent_id: nil, require_two_factor_authentication: false, two_factor_grace_period: 48, cached_markdown_version: 1>, :project_id=>#<Project id: 41, name: "xxx", path: "xxx", description: "", created_at: "2017-08-19 09:41:33", updated_at: "2017-08-19 09:41:33", creator_id: 1, namespace_id: 21, last_activity_at: "2017-08-19 09:41:33", import_url: nil, visibility_level: 0, archived: false, avatar: nil, import_status: "none", star_count: 0, import_type: nil, import_source: nil, import_error: nil, ci_id: nil, shared_runners_enabled: true, runners_token: "J-GyA64Rhp6PsxMSmzDQ", build_coverage_regex: nil, build_allow_git_fetch: true, build_timeout: 3600, public_builds: true, pending_delete: false, last_repository_check_failed: nil, last_repository_check_at: nil, container_registry_enabled: true, only_allow_merge_if_pipeline_succeeds: false, has_external_issue_tracker: false, repository_storage: "default", request_access_enabled: false, has_external_wiki: false, lfs_enabled: nil, description_html: "", only_allow_merge_if_all_discussions_are_resolved: false, ci_config_path: nil, printing_merge_request_link_enabled: true, auto_cancel_pending_pipelines: 1, import_jid: nil, cached_markdown_version: 1, last_repository_updated_at: "2017-08-19 09:45:44", repository_size: nil, commit_count: nil>} missing required keys: [:id]):
    19:   %nav.project-stats{ class: container_class }
    20:     %ul.nav
    21:       %li
    22:         = link_to project_tree_path(@project) do
    23:           #{_('Files')} (#{storage_counter(@project.statistics.total_repository_size)})
    24:       %li
    25:         = link_to project_commits_path(@project, current_ref) do
  config/application.rb:177:in `block (4 levels) in <class:Application>'
  app/views/projects/show.html.haml:22:in `_app_views_projects_show_html_haml___971524631401814949_69815824888440'
  lib/gitlab/i18n.rb:45:in `with_locale'
  lib/gitlab/i18n.rb:51:in `with_user_locale'
  app/controllers/application_controller.rb:294:in `set_locale'
  lib/gitlab/performance_bar/peek_performance_bar_with_rack_body.rb:16:in `call'
  lib/gitlab/middleware/multipart.rb:93:in `call'
  lib/gitlab/request_profiler/middleware.rb:14:in `call'
  lib/gitlab/middleware/go.rb:16:in `call'
  lib/gitlab/etag_caching/middleware.rb:11:in `call'
  lib/gitlab/request_context.rb:18:in `call'
  lib/gitlab/metrics/requests_rack_middleware.rb:27:in `call'

Major Problem?

Here is the structure of the public.projects table

gitlab-rails dbconsole
psql (9.2.18)
Type "help" for help.

gitlabhq_production=> \d+ projects
                                                                            Table "public.projects"
                      Column                      |            Type             |                       Modifiers                       | Storage  | Stats target | Descrip
tion 
--------------------------------------------------+-----------------------------+-------------------------------------------------------+----------+--------------+--------
-----
 id                                               | integer                     | not null default nextval('projects_id_seq'::regclass) | plain    |              | 
 name                                             | character varying(255)      |                                                       | extended |              | 
 path                                             | character varying(255)      |                                                       | extended |              | 
 description                                      | text                        |                                                       | extended |              | 
 created_at                                       | timestamp without time zone |                                                       | plain    |              | 
 updated_at                                       | timestamp without time zone |                                                       | plain    |              | 
 creator_id                                       | integer                     |                                                       | plain    |              | 
 namespace_id                                     | integer                     |                                                       | plain    |              | 
 last_activity_at                                 | timestamp without time zone |                                                       | plain    |              | 
 import_url                                       | character varying(255)      |                                                       | extended |              | 
 visibility_level                                 | integer                     | not null default 0                                    | plain    |              | 
 archived                                         | boolean                     | not null default false                                | plain    |              | 
 avatar                                           | character varying(255)      |                                                       | extended |              | 
 import_status                                    | character varying(255)      |                                                       | extended |              | 
 star_count                                       | integer                     | not null default 0                                    | plain    |              | 
 import_type                                      | character varying(255)      |                                                       | extended |              | 
 import_source                                    | character varying(255)      |                                                       | extended |              | 
 import_error                                     | text                        |                                                       | extended |              | 
 ci_id                                            | integer                     |                                                       | plain    |              | 
 shared_runners_enabled                           | boolean                     | not null default true                                 | plain    |              | 
 runners_token                                    | character varying           |                                                       | extended |              | 
 build_coverage_regex                             | character varying           |                                                       | extended |              | 
 build_allow_git_fetch                            | boolean                     | not null default true                                 | plain    |              | 
 build_timeout                                    | integer                     | not null default 3600                                 | plain    |              | 
 public_builds                                    | boolean                     | not null default true                                 | plain    |              | 
 pending_delete                                   | boolean                     | default false                                         | plain    |              | 
 last_repository_check_failed                     | boolean                     |                                                       | plain    |              | 
 last_repository_check_at                         | timestamp without time zone |                                                       | plain    |              | 
 container_registry_enabled                       | boolean                     |                                                       | plain    |              | 
 only_allow_merge_if_pipeline_succeeds            | boolean                     | not null default false                                | plain    |              | 
 has_external_issue_tracker                       | boolean                     |                                                       | plain    |              | 
 repository_storage                               | character varying           | not null default 'default'::character varying         | extended |              | 
 request_access_enabled                           | boolean                     | not null default false                                | plain    |              | 
 has_external_wiki                                | boolean                     |                                                       | plain    |              | 
 lfs_enabled                                      | boolean                     |                                                       | plain    |              | 
 description_html                                 | text                        |                                                       | extended |              | 
 only_allow_merge_if_all_discussions_are_resolved | boolean                     |                                                       | plain    |              | 
 ci_config_path                                   | character varying           |                                                       | extended |              | 
 printing_merge_request_link_enabled              | boolean                     | not null default true                                 | plain    |              | 
 auto_cancel_pending_pipelines                    | integer                     | not null default 1                                    | plain    |              | 
 import_jid                                       | character varying           |                                                       | extended |              | 
 cached_markdown_version                          | integer                     |                                                       | plain    |              | 
 last_repository_updated_at                       | timestamp without time zone |                                                       | plain    |              | 
 repository_size                                  | integer                     | default 0.0                                           | plain    |              | 
 commit_count                                     | integer                     | default 0.0                                           | plain    |              | 
Indexes:
    "projects_pkey" PRIMARY KEY, btree (id)
    "index_on_projects_lower_path" btree (lower(path::text))
    "index_projects_on_ci_id" btree (ci_id)
    "index_projects_on_created_at" btree (created_at)
    "index_projects_on_creator_id" btree (creator_id)
    "index_projects_on_description_trigram" gin (description gin_trgm_ops)
    "index_projects_on_last_activity_at" btree (last_activity_at)
    "index_projects_on_last_repository_check_failed" btree (last_repository_check_failed)
    "index_projects_on_last_repository_updated_at" btree (last_repository_updated_at)
    "index_projects_on_name_trigram" gin (name gin_trgm_ops)
    "index_projects_on_namespace_id" btree (namespace_id)
    "index_projects_on_path" btree (path)
    "index_projects_on_path_trigram" gin (path gin_trgm_ops)
    "index_projects_on_pending_delete" btree (pending_delete)
    "index_projects_on_runners_token" btree (runners_token)
    "index_projects_on_star_count" btree (star_count)
    "index_projects_on_visibility_level" btree (visibility_level)
Referenced by:
    TABLE "events" CONSTRAINT "fk_0434b48643" FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
    TABLE "web_hooks" CONSTRAINT "fk_0c8ca6d9d1" FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
    TABLE "project_features" CONSTRAINT "fk_18513d9b92" FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
    TABLE "users_star_projects" CONSTRAINT "fk_22cd27ddfc" FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
    TABLE "ci_stages" CONSTRAINT "fk_2360681d1d" FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
    TABLE "forked_project_links" CONSTRAINT "fk_434510edb0" FOREIGN KEY (forked_to_project_id) REFERENCES projects(id) ON DELETE CASCADE
    TABLE "ci_runner_projects" CONSTRAINT "fk_4478a6f1e4" FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
    TABLE "todos" CONSTRAINT "fk_45054f9c45" FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
    TABLE "releases" CONSTRAINT "fk_47fe2a0596" FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
    TABLE "deploy_keys_projects" CONSTRAINT "fk_58a901ca7e" FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
    TABLE "services" CONSTRAINT "fk_71cce407f9" FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
    TABLE "protected_branches" CONSTRAINT "fk_7a9c6d93e7" FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
    TABLE "labels" CONSTRAINT "fk_7de4989a69" FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
    TABLE "ci_pipelines" CONSTRAINT "fk_86635dbd80" FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
    TABLE "issues" CONSTRAINT "fk_899c8f3231" FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
    TABLE "protected_tags" CONSTRAINT "fk_8e4af87648" FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
    TABLE "ci_pipeline_schedules" CONSTRAINT "fk_8ead60fcc4" FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
    TABLE "notes" CONSTRAINT "fk_99e097b079" FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
    TABLE "milestones" CONSTRAINT "fk_9bd0a0c791" FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
    TABLE "merge_requests" CONSTRAINT "fk_a6963e8447" FOREIGN KEY (target_project_id) REFERENCES projects(id) ON DELETE CASCADE
    TABLE "ci_variables" CONSTRAINT "fk_ada5eb64b3" FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
    TABLE "deployments" CONSTRAINT "fk_b9a3851b82" FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
    TABLE "snippets" CONSTRAINT "fk_be41fd4bb7" FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
    TABLE "ci_builds" CONSTRAINT "fk_befce0568a" FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
    TABLE "environments" CONSTRAINT "fk_d1c8c1da6a" FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
    TABLE "project_group_links" CONSTRAINT "fk_daa8cee94c" FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
    TABLE "ci_triggers" CONSTRAINT "fk_e3e63f966e" FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
    TABLE "pages_domains" CONSTRAINT "fk_ea2f6dfc6f" FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
    TABLE "boards" CONSTRAINT "fk_f15266b5f9" FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
    TABLE "project_import_data" CONSTRAINT "fk_ffb9ee3a10" FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
    TABLE "trending_projects" CONSTRAINT "fk_rails_09feecd872" FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
    TABLE "project_authorizations" CONSTRAINT "fk_rails_0f84bb11f3" FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
    TABLE "project_statistics" CONSTRAINT "fk_rails_12c471002f" FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
    TABLE "container_repositories" CONSTRAINT "fk_rails_32f7bf5aad" FOREIGN KEY (project_id) REFERENCES projects(id)
    TABLE "subscriptions" CONSTRAINT "fk_rails_d0c8bda804" FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
    TABLE "label_priorities" CONSTRAINT "fk_rails_ef916d14fa" FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
Has OIDs: no

Results of GitLab environment info

Expand for output related to GitLab environment info
sudo gitlab-rake gitlab:env:info

System information
System:		
Current User:	git
Using RVM:	no
Ruby Version:	2.3.3p222
Gem Version:	2.6.6
Bundler Version:1.13.7
Rake Version:	10.5.0
Redis Version:	3.2.5
Git Version:	2.13.4
Sidekiq Version:5.0.0
Go Version:	unknown

GitLab information
Version:	9.4.5
Revision:	140292e
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	postgresql
URL:		xxxx
HTTP Clone URL:	xxxx/some-group/some-project.git
SSH Clone URL:	git@xxxx:some-group/some-project.git
Using LDAP:	no
Using Omniauth:	no

GitLab Shell
Version:	5.3.1
Repository storage paths:
- default: 	/var/opt/gitlab/git-data/repositories
Hooks:		/opt/gitlab/embedded/service/gitlab-shell/hooks
Git:		/opt/gitlab/embedded/bin/git

Results of GitLab application Check

Expand for output related to the GitLab application check
sudo gitlab-rake gitlab:check SANITIZE=true
Checking GitLab Shell ...

GitLab Shell version >= 5.3.1 ? ... OK (5.3.1)
Repo base directory exists?
default... yes
Repo storage directories are symlinks?
default... no
Repo paths owned by git:root, or git:git?
default... yes
Repo paths access is drwxrws---?
default... yes
hooks directories in repos are links: ... 
3/1 ... ok
3/3 ... ok
3/4 ... ok
5/5 ... ok
5/7 ... ok
5/9 ... ok
5/11 ... ok
5/12 ... ok
5/13 ... ok
5/14 ... ok
3/15 ... ok
3/22 ... ok
3/23 ... ok
5/24 ... ok
14/25 ... ok
14/26 ... ok
5/27 ... ok
15/29 ... ok
15/30 ... ok
15/31 ... ok
15/34 ... ok
15/35 ... ok
15/36 ... ok
15/38 ... ok
5/39 ... ok
3/40 ... ok
21/41 ... ok
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Check GitLab API access: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: OK
Send ping to redis server: OK
gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Sidekiq ...

Running? ... yes
Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Checking Reply by email ...

Reply by email is disabled in config/gitlab.yml

Checking Reply by email ... Finished

Checking LDAP ...

LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab ...

Git configured correctly? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config up to date? ... yes
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory exists? ... yes
Uploads directory has correct permissions? ... yes
Uploads directory tmp has correct permissions? ... no
  Try fixing it:
  sudo chown -R git /var/opt/gitlab/gitlab-rails/uploads
  sudo find /var/opt/gitlab/gitlab-rails/uploads -type f -exec chmod 0644 {} \;
  sudo find /var/opt/gitlab/gitlab-rails/uploads -type d -not -path /var/opt/gitlab/gitlab-rails/uploads -exec chmod 0700 {} \;
  For more information see:
  doc/install/installation.md in section "GitLab"
  Please fix the error above and rerun the checks.
Init script exists? ... skipped (omnibus-gitlab has no init script)
Init script up-to-date? ... skipped (omnibus-gitlab has no init script)
Projects have namespace: ... 
3/1 ... yes
3/3 ... yes
3/4 ... yes
5/5 ... yes
5/7 ... yes
5/9 ... yes
5/11 ... yes
5/12 ... yes
5/13 ... yes
5/14 ... yes
3/15 ... yes
3/22 ... yes
3/23 ... yes
5/24 ... yes
14/25 ... yes
14/26 ... yes
5/27 ... yes
15/29 ... yes
15/30 ... yes
15/31 ... yes
15/34 ... yes
15/35 ... yes
15/36 ... yes
15/38 ... yes
5/39 ... yes
3/40 ... yes
21/41 ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.3.3 ? ... yes (2.3.3)
Git version >= 2.7.3 ? ... yes (2.13.4)
Active users: ... 11

Checking GitLab ... Finished
Assignee Loading
Time tracking Loading