Prepare to convert primary type for ci_build_needs table
What does this MR do?
This change adds database migrations to prepare ci_build_needs
for a type change of foreign key build_id
to ci_builds
(int -> bigint).
- Add column
ci_build_needs.build_id_convert_to_bigint
- Add triggers to keep this column in sync with
build_id
- Ignore the added column on the
Ci::BuildNeed
model - Work around a limitation of
accepts_nested_attributes_for
which doesn't exclude ignored columns
Without (4), this causes problems with the "retry builds" feature. See spec failures in https://gitlab.com/gitlab-org/gitlab/-/jobs/1183797636.
From commit message:
In Ci::Processable, we define `accepts_nested_attributes_for :needs`.
Unfortunately, this does not exclude columns ignored on `Ci::BuildNeed`.
There is a database trigger in place, that always keeps the
`build_id_convert_to_bigint` column in sync with `build_id`. Hence, a
copy of a build (e.g. when retrying) will have a different value for
this column compared to before.
This should be a temporary workaround while we maintain that column
through database trigger.
Does this MR meet the acceptance criteria?
Conformity
-
📋 Does this MR need a changelog?-
I have included a changelog entry. -
I have not included a changelog entry because _____.
-
-
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Edited by Kamil Trzciński