Files
fizzy/db/migrate/20250422054950_add_source_to_notifications.rb
T
Jorge Manrubia 71c20f9685 FIx migration
2025-04-23 18:45:45 +02:00

12 lines
323 B
Ruby

class AddSourceToNotifications < ActiveRecord::Migration[8.1]
def change
add_reference :notifications, :source, polymorphic: true, index: true
execute <<~SQL
update notifications set source_type = 'Event', source_id = event_id;
SQL
change_column_null :notifications, :source_type, false
end
end