diff --git a/db/migrate/20180812173710_copy_status_stats.rb b/db/migrate/20180812173710_copy_status_stats.rb index 6ecccc0ae65..64a564ca07b 100644 --- a/db/migrate/20180812173710_copy_status_stats.rb +++ b/db/migrate/20180812173710_copy_status_stats.rb @@ -4,8 +4,8 @@ class CopyStatusStats < ActiveRecord::Migration[5.2] def up safety_assured do execute <<-SQL.squish - INSERT INTO status_stats (status_id, reblogs_count, favourites_count) - SELECT id, reblogs_count, favourites_count + INSERT INTO status_stats (status_id, reblogs_count, favourites_count, created_at, updated_at) + SELECT id, reblogs_count, favourites_count, created_at, updated_at FROM statuses ON CONFLICT (status_id) DO UPDATE SET reblogs_count = EXCLUDED.reblogs_count, favourites_count = EXCLUDED.favourites_count