forked from treehouse/mastodon
Fix older migrations not working due to new default scope (#11983)
Fix #11952, regression from #11623signup-info-prompt
parent
ab33c4df94
commit
27719a4001
|
@ -3,7 +3,7 @@ class AddInReplyToAccountIdToStatuses < ActiveRecord::Migration[5.0]
|
||||||
add_column :statuses, :in_reply_to_account_id, :integer, null: true, default: nil
|
add_column :statuses, :in_reply_to_account_id, :integer, null: true, default: nil
|
||||||
|
|
||||||
ActiveRecord::Base.transaction do
|
ActiveRecord::Base.transaction do
|
||||||
Status.where.not(in_reply_to_id: nil).includes(:thread).find_each do |status|
|
Status.unscoped.where.not(in_reply_to_id: nil).includes(:thread).find_each do |status|
|
||||||
next if status.thread.nil?
|
next if status.thread.nil?
|
||||||
|
|
||||||
status.in_reply_to_account_id = status.thread.account_id
|
status.in_reply_to_account_id = status.thread.account_id
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
class AddReplyToStatuses < ActiveRecord::Migration[5.0]
|
class AddReplyToStatuses < ActiveRecord::Migration[5.0]
|
||||||
def up
|
def up
|
||||||
add_column :statuses, :reply, :boolean, nil: false, default: false
|
add_column :statuses, :reply, :boolean, nil: false, default: false
|
||||||
Status.update_all('reply = (in_reply_to_id IS NOT NULL)')
|
Status.unscoped.update_all('reply = (in_reply_to_id IS NOT NULL)')
|
||||||
end
|
end
|
||||||
|
|
||||||
def down
|
def down
|
||||||
|
|
Loading…
Reference in New Issue