Draft: Demonstrate issue with trigger and null values
What does this MR do and why?
Minimal reproduction case for bug discovered while working on !80065 (merged)
See !80537 (merged)
How to set up and validate locally
This can be demonstrated by constructing an object and then saving it:
[1] pry> i = build(:integration, type: 'Integrations::Jira' , project: project)
=> #<Integration:0x00007f59eb8b2d78
id: nil,
project_id: 1,
...
type_new: "Integrations::Jira",
...
>
[2] pry> i.type
=> "Integrations::Jira" # looks good!
[3] pry> i.save!
=> true # great!
[4] pry> i.type
=> "Integrations::Jira" # excellent!
[5] pry> i.type_new
=> "Integrations::Jira" # perfect!
[6] pry> Integration.pluck(:type_new, :type)
=> [[nil, nil], ...] # oh no!
We can prove that this is due to the trigger thusly:
[.] pry> Integration.connection.execute 'ALTER TABLE integrations DISABLE TRIGGER "trigger_type_new_on_insert"'
[.] pry> i = build(:integration, type: 'Integrations::Jira' , project: project)
[.] pry> i.save!
[.] pry> Integration.pluck(:id, :type_new, :type)
=> [..., [12, nil, nil], [13, "Integrations::Jira", "Integrations::Jira"]]
MR acceptance checklist
THIS MR MUST NOT BE MERGED
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #333508 (closed)
Edited by Alex Kalderimis