FIX: ReviewableUser is not created yet
This commit is contained in:
parent
fd6513b516
commit
d873b9b2ad
|
@ -24,26 +24,6 @@ class CreateReviewableUsers < ActiveRecord::Migration[5.2]
|
||||||
FROM users
|
FROM users
|
||||||
WHERE approved = false
|
WHERE approved = false
|
||||||
SQL
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -10,5 +10,25 @@ class CreateReviewableHistories < ActiveRecord::Migration[5.2]
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index :reviewable_histories, :reviewable_id
|
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
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue