9.0 Database Migration issue
Summary
Database migrations on 9.0 upgrade fail on at RemoveUnusedCiTablesAndColumns
Steps to reproduce
gitlab-rake db:migrate RAILS_ENV=production
What is the current bug behavior?
Database migration fails
What is the expected correct behavior?
Database migrations complete successfully
Relevant logs and/or screenshots
== 20170301205639 RemoveUnusedCiTablesAndColumns: migrating ===================
-- drop_table("ci_application_settings")
-> 0.0014s
-- drop_table("ci_events")
-> 0.0011s
-- drop_table("ci_jobs")
-> 0.0010s
-- drop_table("ci_sessions")
-> 0.0009s
-- drop_table("ci_taggings")
-> 0.0010s
-- drop_table("ci_tags")
-> 0.0008s
-- remove_column(:ci_pipelines, :push_data, :text)
-> 0.0004s
-- remove_column(:ci_builds, :job_id, :integer)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
PG::UndefinedColumn: ERROR: column "job_id" of relation "ci_builds" does not exist
: ALTER TABLE "ci_builds" DROP "job_id"/opt/gitlab/embedded/service/gitlab-rails/db/migrate/20170301205639_remove_unused_ci_tables_and_columns.rb:20:in `up'
/opt/gitlab/embedded/bin/bundle:22:in `load'
/opt/gitlab/embedded/bin/bundle:22:in `<main>'
ActiveRecord::StatementInvalid: PG::UndefinedColumn: ERROR: column "job_id" of relation "ci_builds" does not exist
: ALTER TABLE "ci_builds" DROP "job_id"
/opt/gitlab/embedded/service/gitlab-rails/db/migrate/20170301205639_remove_unused_ci_tables_and_columns.rb:20:in `up'
/opt/gitlab/embedded/bin/bundle:22:in `load'
/opt/gitlab/embedded/bin/bundle:22:in `<main>'
PG::UndefinedColumn: ERROR: column "job_id" of relation "ci_builds" does not exist
/opt/gitlab/embedded/service/gitlab-rails/db/migrate/20170301205639_remove_unused_ci_tables_and_columns.rb:20:in `up'
/opt/gitlab/embedded/bin/bundle:22:in `load'
/opt/gitlab/embedded/bin/bundle:22:in `<main>'
Output of checks
Results of GitLab environment info
System information
System: Ubuntu 14.04
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.10.2
Sidekiq Version:4.2.7
GitLab information
Version: 9.0.0
Revision: cf020e6
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: postgresql
URL: https://gitlab.example.com
HTTP Clone URL: https://gitlab.example.com/some-group/some-project.git
SSH Clone URL: git@gitlab.example.com:some-group/some-project.git
Using LDAP: no
Using Omniauth: yes
Omniauth Providers: github, saml, azure_oauth2
GitLab Shell
Version: 5.0.0
Repository storage paths:
- default: /mnt/gitlab-repos/repositories
Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks/
Git: /opt/gitlab/embedded/bin/git
Results of GitLab application Check
Checking GitLab Shell ...
GitLab Shell version >= 5.0.0 ? ... OK (5.0.0)
Repo base directory exists?
default... yes
Repo storage directories are symlinks?
default... no
Repo paths owned by git:git?
default... yes
Repo paths access is drwxrws---?
default... yes
hooks directories in repos are links: ...
62/7 ... ok
2/11 ... ok
2/17 ... ok
2/18 ... ok
2/19 ... ok
2/20 ... ok
2/21 ... ok
2/23 ... ok
2/24 ... ok
2/27 ... ok
2/29 ... ok
2/31 ... ok
2/32 ... ok
2/35 ... ok
62/38 ... ok
62/39 ... ok
2/40 ... ok
62/42 ... ok
62/43 ... ok
62/44 ... ok
62/45 ... ok
62/46 ... ok
2/49 ... ok
2/50 ... ok
84/52 ... ok
84/53 ... ok
2/54 ... ok
2/56 ... ok
62/57 ... ok
105/58 ... ok
105/60 ... ok
105/61 ... ok
2/62 ... ok
113/63 ... ok
113/64 ... ok
2/65 ... ok
113/66 ... ok
119/68 ... ok
105/69 ... repository is empty
128/70 ... ok
128/71 ... repository is empty
128/72 ... repository is empty
128/73 ... repository is empty
105/76 ... ok
134/77 ... ok
61/78 ... ok
140/79 ... ok
139/80 ... ok
105/81 ... ok
105/82 ... ok
137/83 ... ok
138/84 ... ok
8/85 ... ok
134/86 ... ok
134/87 ... ok
134/88 ... ok
134/89 ... ok
2/90 ... repository is empty
105/92 ... ok
105/93 ... repository is empty
105/94 ... ok
105/95 ... ok
105/96 ... ok
105/97 ... ok
105/99 ... 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 ...
IMAP server credentials are correct? ... yes
Init.d configured correctly? ... skipped (omnibus-gitlab has no init script)
MailRoom running? ... can't check because of previous errors
Checking Reply by email ... Finished
Checking LDAP ...
LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab ...
Git configured with autocrlf=input? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory setup correctly? ... yes
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: ...
62/7 ... yes
2/11 ... yes
2/17 ... yes
2/18 ... yes
2/19 ... yes
2/20 ... yes
2/21 ... yes
2/23 ... yes
2/24 ... yes
2/27 ... yes
2/29 ... yes
2/31 ... yes
2/32 ... yes
2/35 ... yes
62/38 ... yes
62/39 ... yes
2/40 ... yes
62/42 ... yes
62/43 ... yes
62/44 ... yes
62/45 ... yes
62/46 ... yes
2/49 ... yes
2/50 ... yes
84/52 ... yes
84/53 ... yes
2/54 ... yes
2/56 ... yes
62/57 ... yes
105/58 ... yes
105/60 ... yes
105/61 ... yes
2/62 ... yes
113/63 ... yes
113/64 ... yes
2/65 ... yes
113/66 ... yes
119/68 ... yes
105/69 ... yes
128/70 ... yes
128/71 ... yes
128/72 ... yes
128/73 ... yes
105/76 ... yes
134/77 ... yes
61/78 ... yes
140/79 ... yes
139/80 ... yes
105/81 ... yes
105/82 ... yes
137/83 ... yes
138/84 ... yes
8/85 ... yes
134/86 ... yes
134/87 ... yes
134/88 ... yes
134/89 ... yes
2/90 ... yes
105/92 ... yes
105/93 ... yes
105/94 ... yes
105/95 ... yes
105/96 ... yes
105/97 ... yes
105/99 ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.1.0 ? ... yes (2.3.3)
Your git bin path is "/opt/gitlab/embedded/bin/git"
Git version >= 2.7.3 ? ... yes (2.10.2)
Active users: 116
Checking GitLab ... Finished