Skip to content

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:

These changes are already in that MR, to confirm they solve everything. Only tried them out locally.

Does this MR meet the acceptance criteria?

Merge request reports