FIX: ReviewableUser is not created yet

This commit is contained in:
Robin Ward 2019-03-28 14:57:44 -04:00
parent fd6513b516
commit d873b9b2ad
2 changed files with 20 additions and 20 deletions

View File

@ -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

View File

@ -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