Source code for the custom Mastodon (Glitchsoc) instance on berserker.town.
https://berserker.town/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
564 B
20 lines
564 B
# frozen_string_literal: true
|
|
|
|
class AddInReplyToAccountIdToStatuses < ActiveRecord::Migration[5.0]
|
|
def up
|
|
add_column :statuses, :in_reply_to_account_id, :integer, null: true, default: nil
|
|
|
|
ActiveRecord::Base.transaction do
|
|
Status.unscoped.where.not(in_reply_to_id: nil).includes(:thread).find_each do |status|
|
|
next if status.thread.nil?
|
|
|
|
status.in_reply_to_account_id = status.thread.account_id
|
|
status.save(validate: false)
|
|
end
|
|
end
|
|
end
|
|
|
|
def down
|
|
remove_column :statuses, :in_reply_to_account_id
|
|
end
|
|
end
|
|
|