Do not check column default in state machine initialization

UPDATE: Turns out this might have fixed a severity2 typebug #588806 (comment 3176015805)

What does this MR do and why?

Do not check column default in state machine initialization

The upstream implementation currently checks the column default, only so that it can warn that there is an inconsistency between the column default and the state machine default.

Also the way state_machines-activerecord gets this column default is inconsistent, it only gets it if the class already has a previous DB connection.

So we monkey-patch this warning out of the state machine initialization code.

We still keep the warning code so that we can call it from a spec, for every model that use state_machine.

References

#586582 (comment 3147990274)

Screenshots or screen recordings

Before After

How to set up and validate locally

Compare to the code in https://rubygems.org/gems/state_machines/versions/0.100.4, the monkey-patch should be functionally the same. Except for the code to warn about differing defaults

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Thong Kuah

Merge request reports

Loading