FIX: Missing events for ReviewableUser migration

This commit is contained in:
Robin Ward 2019-03-28 15:25:26 -04:00
parent fdaf17ec7c
commit a282ade9c6
1 changed files with 19 additions and 0 deletions

View File

@ -12,6 +12,25 @@ class CreateReviewableHistories < ActiveRecord::Migration[5.2]
add_index :reviewable_histories, :reviewable_id add_index :reviewable_histories, :reviewable_id
# Migrate Created ReviewableUser History # Migrate Created ReviewableUser History
execute(<<~SQL)
INSERT INTO reviewable_histories (
reviewable_id,
reviewable_history_type,
status,
created_by_id,
created_at,
updated_at
)
SELECT r.id,
0,
0,
r.created_by_id,
r.created_at,
r.created_at
FROM reviewables AS r
WHERE r.type = 'ReviewableUser'
SQL
execute(<<~SQL) execute(<<~SQL)
INSERT INTO reviewable_histories ( INSERT INTO reviewable_histories (
reviewable_id, reviewable_id,