BigW Consortium Gitlab

Commit 7c135bb4 by Douwe Maan Committed by Jose Ivan Vargas

Merge branch 'fix-broadcast-messages-migration' into 'master'

Remove invalid broadcast messages before migrating See merge request !13538
parent 3ef2fb2b
......@@ -9,9 +9,21 @@ class AddBroadcastMessageNotNullConstraints < ActiveRecord::Migration
COLUMNS = %i[starts_at ends_at created_at updated_at message_html]
def change
class BroadcastMessage < ActiveRecord::Base
self.table_name = 'broadcast_messages'
end
def up
COLUMNS.each do |column|
BroadcastMessage.where(column => nil).delete_all
change_column_null :broadcast_messages, column, false
end
end
def down
COLUMNS.each do |column|
change_column_null :broadcast_messages, column, true
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment