Commit 0bd00893 authored by Andreas Brandl's avatar Andreas Brandl Committed by Heinrich Lee Yu

Work around nested attributes

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.
parent 84944021
...@@ -5,8 +5,9 @@ module Ci ...@@ -5,8 +5,9 @@ module Ci
extend Gitlab::Ci::Model extend Gitlab::Ci::Model
include BulkInsertSafe include BulkInsertSafe
include IgnorableColumns
self.ignored_columns += [:build_id_convert_to_bigint] # rubocop:disable Cop/IgnoredColumns ignore_columns :build_id_convert_to_bigint, remove_with: '14.1', remove_after: '2021-07-22'
belongs_to :build, class_name: "Ci::Processable", foreign_key: :build_id, inverse_of: :needs belongs_to :build, class_name: "Ci::Processable", foreign_key: :build_id, inverse_of: :needs
...@@ -16,5 +17,9 @@ module Ci ...@@ -16,5 +17,9 @@ module Ci
scope :scoped_build, -> { where('ci_builds.id=ci_build_needs.build_id') } scope :scoped_build, -> { where('ci_builds.id=ci_build_needs.build_id') }
scope :artifacts, -> { where(artifacts: true) } scope :artifacts, -> { where(artifacts: true) }
def attributes
super.except('build_id_convert_to_bigint')
end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment