Skip to content

Drop default value on status column in deployments table

Shinya Maeda requested to merge drop-default-value-status-deployments into master

What does this MR do?

Currently, when you load rails application (e.g. via bundle exec rspec), you will see the following warning.

Both Deployment and its :status machine have defined a different default for "status". Use only one or the other for defining defaults to avoid unexpected behaviors.

According to https://github.com/pluginaweek/state_machine/issues/279, this is because the state_machine's default value and database's default value are different. In fact, the former is 0 (:created), and the latter is 2 (:success), today.

There was a reason why it ended up like so, however, after we have finished the add_column_with_default migration, we can drop the default value on status column. Ideally, this value should be initialized by the state machine.

What are the relevant issue numbers?

Close https://gitlab.com/gitlab-org/gitlab-ce/issues/53702

Does this MR meet the acceptance criteria?

Edited by Shinya Maeda

Merge request reports