Commit Graph

4 Commits

Author SHA1 Message Date
GitLab Bot e58ce90f14 Add latest changes from gitlab-org/gitlab@master 2021-06-11 18:10:13 +00:00
GitLab Bot c59765a50a Add latest changes from gitlab-org/gitlab@master 2020-06-24 18:09:03 +00:00
GitLab Bot fca89bb73f Add latest changes from gitlab-org/gitlab@master 2020-03-11 21:09:19 +00:00
Stan Hu 1b06377812 Prevent EE backport migrations from running if CE is not migrated
If a user upgraded to any GitLab 11.x EE version but switched
back to CE, it's possible the state of the EE tables are not
in the right state for the EE backport migration to work properly.
In particular, there were three tables that had trouble:

* epics
* geo_event_log
* vulnerability_feedback

The EE backport migration would fail while trying to add foreign key
constraints because a key didn't exist in the table. This happens
because any EE migration that add or removed columns between v11.0.0 and
v11.11.3 are not guaranteed to be applied in an CE installation. The EE
backport schema does not individually backport these migrations.

We now check if certain columns are present to determine whether
the backport migration is in the proper state. CE users are required
to upgrade to v11.11.3 EE if they ever installed EE previously before
they can go back to v12.x CE.

Tested via:

```
git checkout -f v11.0.0-ee
bundle exec rake db:reset
git checkout .; git checkout -f v11.11.3
bundle exec rake db:migrate
git checkout .; git checkout -f v12.0.0
bundle exec rake db:migrate
<failure happens>
```
2019-06-25 05:42:10 -07:00