logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

20161202132159_add_in_reply_to_account_id_to_statuses.rb (524B)


  1. class AddInReplyToAccountIdToStatuses < ActiveRecord::Migration[5.0]
  2. def up
  3. add_column :statuses, :in_reply_to_account_id, :integer, null: true, default: nil
  4. ActiveRecord::Base.transaction do
  5. Status.where.not(in_reply_to_id: nil).includes(:thread).find_each do |status|
  6. next if status.thread.nil?
  7. status.in_reply_to_account_id = status.thread.account_id
  8. status.save(validate: false)
  9. end
  10. end
  11. end
  12. def down
  13. remove_column :statuses, :in_reply_to_account_id
  14. end
  15. end