Fix null constraint violation in copy status stats migration (#8198)

pull/642/head
Eugen Rochko 2018-08-14 20:24:36 +02:00 committed by GitHub
parent 8e111b753a
commit be13e95d06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -4,8 +4,8 @@ class CopyStatusStats < ActiveRecord::Migration[5.2]
def up def up
safety_assured do safety_assured do
execute <<-SQL.squish execute <<-SQL.squish
INSERT INTO status_stats (status_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 SELECT id, reblogs_count, favourites_count, created_at, updated_at
FROM statuses FROM statuses
ON CONFLICT (status_id) DO UPDATE ON CONFLICT (status_id) DO UPDATE
SET reblogs_count = EXCLUDED.reblogs_count, favourites_count = EXCLUDED.favourites_count SET reblogs_count = EXCLUDED.reblogs_count, favourites_count = EXCLUDED.favourites_count