Database migration failure during the EE upgrade
It appears that there is a broken migration when upgrading EE. See Gitlab QA test log.
We had a conversation with @rymai on Slack about it:
remy [10:16 AM]
Hmm, we backported this feature to CE with a duplicate migration in CE: AddEstimateToIssuablesCe, which skips the creation of the columns if they already exist
[10:16]
Hmm that’s why then
[10:16]
Since it’s an upgrade
[10:16]
All the CE migrations are run
remy [10:17 AM]
And then the EE one which tries to add the column fails because it’s already been added in CE
remy [10:19 AM]
We need to add the column_exists? check in EE as well, I see that we’re doing that for the `appearances` for instance (which was backported to CE as well)
remy [10:21 AM]
Hmm, the EE migrations were removed a few days ago: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8644
Rename duplicate migrations and skip them if table/columns are already present (!8644) · Merge Requests · GitLab.org / GitLab Community Edition
[10:23]
`db/migrate/20161030005533_add_estimate_to_issuables.rb` is in `master` but not in `8-16-stable-ee` anymore
[10:24]
It’s probably removed in a conflict resolution
grzegorz [10:24 AM]
strange, because migration that is failing in QA is `20161030005533_add_estimate_to_issuables.rb`
[10:24]
not `20161223034433_add_time_estimate_to_issuables.rb`
remy [10:24 AM]
Indeed: https://gitlab.com/gitlab-org/gitlab-ee/commit/dad11c92e9bf64222252d033e3a92259dbf59d55#958b729931b89eb8b2e04c0de9565b7ae6bda8b7
Merge remote-tracking branch 'gitlab-ce/8-16-stable' into 8-16-stable-ee (dad11c92) · Commits · GitLab.org / GitLab Enterprise Edition
# Conflicts: # VERSION # app/views/projects/edit.html.haml # app/views/shared/web_hooks/_form.html.haml # config/routes/project.rb # db/migrate/20161007073613_create_user_activities.rb # db/migrate/20161030005533_add_estimate_to_issuables.rb # features/steps/shared/paths.rb
grzegorz [10:25 AM]
so, it looks like a bad merge, right?
remy [10:25 AM]
@grzegorz Ok, so there are a few things to correct
[10:26]
Add checks for table/column existence for the EE migrations
[10:26]
Once merged, re-add the EE migrations to the `8-16-stable-ee` branch
grzegorz [10:26 AM]
in a patch release?
remy [10:27 AM]
Yes
grzegorz [10:27 AM]
Okay. Do you have idea why this error did not occur during the 8.16.0 deploy to gitlab.com?
remy [10:28 AM]
Because the EE migrations were already run on .com
[10:28]
And the CE migrations have the table/column existence checks
[10:29]
We’ll have to think what’s the case where these missing EE migrations can be a problem