[deploy] Add data update script to backfill public reaction count (#7932)

* Add data update script to backfill public rxn count

* Reduce to two transactions instead of three
This commit is contained in:
Andy Zhao 2020-05-18 17:51:02 -04:00 committed by GitHub
parent 3b9fe2658e
commit 91b14d7d4b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -0,0 +1,8 @@
module DataUpdateScripts
class UpdatePublicReactionsCountFromPositiveReactionsCount
def run
ActiveRecord::Base.connection.execute("UPDATE articles SET public_reactions_count = positive_reactions_count, previous_public_reactions_count = previous_positive_reactions_count")
ActiveRecord::Base.connection.execute("UPDATE comments SET public_reactions_count = positive_reactions_count")
end
end
end