Merge pull request #8187 from jhass/notifications_not_null
Enforce GUID being present for notifications
This commit is contained in:
commit
6c49ba1d2e
1 changed files with 17 additions and 0 deletions
|
|
@ -0,0 +1,17 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class ChangeNotificationsGuidNotNull < ActiveRecord::Migration[5.2]
|
||||
def up
|
||||
Notification.where(guid: nil).find_in_batches do |batch|
|
||||
batch.each do |notification|
|
||||
notification.save!(validate: false, touch: false)
|
||||
end
|
||||
end
|
||||
|
||||
change_column :notifications, :guid, :string, null: false
|
||||
end
|
||||
|
||||
def down
|
||||
change_column :notifications, :guid, :string, null: true
|
||||
end
|
||||
end
|
||||
Loading…
Reference in a new issue