e6fe7f680d
It's kind of a long way to get from one to the other right now. Every event belongs to a bubble, so let's link them directly.
18 lines
459 B
Ruby
18 lines
459 B
Ruby
class AssociateEventsWithBubbles < ActiveRecord::Migration[8.1]
|
|
def change
|
|
change_table :events do |t|
|
|
t.references :bubble, foreign_key: true
|
|
end
|
|
|
|
execute "
|
|
update events
|
|
set bubble_id = m.bubble_id
|
|
from event_summaries es
|
|
join messages m on m.messageable_type = 'EventSummary' and m.messageable_id = es.id
|
|
where events.summary_id = es.id
|
|
"
|
|
|
|
change_column_null :events, :bubble_id, false
|
|
end
|
|
end
|