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