mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 09:33:37 +08:00
14 lines
324 B
Ruby
14 lines
324 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
class PopulateTopicIdOnBookmarks < ActiveRecord::Migration[6.0]
|
||
|
def up
|
||
|
Bookmark.where(topic_id: nil).includes(:post).find_each do |bookmark|
|
||
|
bookmark.update_column(:topic_id, bookmark.post.topic_id)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def down
|
||
|
raise ActiveRecord::IrreversibleMigration
|
||
|
end
|
||
|
end
|