Add a new column before creating rename triggers
What does this MR do?
When renaming a column concurrently, create the new column before creating the trigger.
MySQL doesn't allow us to create a trigger for a column that doesn't exist yet. Failing with this error:
Mysql2::Error: Unknown column 'build_events' in 'NEW': CREATE TRIGGER trigger_6a80c097c862_insert
BEFORE INSERT
ON `services`
FOR EACH ROW
SET NEW.`build_events` = NEW.`job_events`
Creating the new column before creating the trigger avoids this.
I encountered this in !11287 (merged), causing these failures:
- https://gitlab.com/gitlab-org/gitlab-ce/builds/16083000
- https://gitlab.com/gitlab-org/gitlab-ce/builds/16083002
These changes are already in that MR, to confirm they solve everything. Only tried them out locally.
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary -
Documentation created/updated -
API support added - Tests
-
Added for this feature/bug -
All builds are passing
-
-
Conform by the merge request performance guides -
Conform by the style guides -
Branch has no merge conflicts with master
(if it does - rebase it please) -
Squashed related commits together