Revision dd5091f4
Added by Adam Ruzicka 3 months ago
db/migrate/20240305131306_enforce_not_null_host_comment.rb | ||
---|---|---|
class EnforceNotNullHostComment < ActiveRecord::Migration[6.1]
|
||
def up
|
||
::Host.where(comment: nil).update(comment: '')
|
||
::Host::Base.where(comment: nil).update_all(comment: '')
|
||
|
||
change_column_default :hosts, :comment, ''
|
||
change_column_null :hosts, :comment, false
|
Also available in: Unified diff
Refs #37224 - Force all Hosts to have a comment
The previous implementation of the update had two issues:
1) It only operated on ::Host::Managed
2) It silently failed if the host was invalid for any other reason
Fixes 4c7f36edf