From d873b9b2ad1c1a8bebd3a74c89f79b7919cd0bd5 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Thu, 28 Mar 2019 14:57:44 -0400 Subject: [PATCH] FIX: ReviewableUser is not created yet --- .../20190103185626_create_reviewable_users.rb | 20 ------------------- ...90110212005_create_reviewable_histories.rb | 20 +++++++++++++++++++ 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/db/migrate/20190103185626_create_reviewable_users.rb b/db/migrate/20190103185626_create_reviewable_users.rb index b4f53ad9545..51cdde03394 100644 --- a/db/migrate/20190103185626_create_reviewable_users.rb +++ b/db/migrate/20190103185626_create_reviewable_users.rb @@ -24,26 +24,6 @@ class CreateReviewableUsers < ActiveRecord::Migration[5.2] FROM users WHERE approved = false SQL - - # Migrate Created History - execute(<<~SQL) - INSERT INTO reviewable_histories ( - reviewable_id, - reviewable_history_type, - status, - created_by_id, - created_at, - updated_at - ) - SELECT r.id, - 1, - 1, - r.created_by_id, - r.created_at, - r.created_at - FROM reviewables AS r - WHERE r.type = 'ReviewableUser' - SQL end end diff --git a/db/migrate/20190110212005_create_reviewable_histories.rb b/db/migrate/20190110212005_create_reviewable_histories.rb index 0a54fc0629b..54f7718d1c2 100644 --- a/db/migrate/20190110212005_create_reviewable_histories.rb +++ b/db/migrate/20190110212005_create_reviewable_histories.rb @@ -10,5 +10,25 @@ class CreateReviewableHistories < ActiveRecord::Migration[5.2] end add_index :reviewable_histories, :reviewable_id + + # 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, + 1, + 1, + r.created_by_id, + r.created_at, + r.created_at + FROM reviewables AS r + WHERE r.type = 'ReviewableUser' + SQL end end