Enforce GUID being present for notifications

This commit is contained in:
Jonne Haß 2020-11-30 15:41:04 +01:00
parent d2acad1aed
commit 07ec46e151

View file

@ -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