Skip to content

Commit

Permalink
Remove Stems that no longer have a Question
Browse files Browse the repository at this point in the history
  • Loading branch information
Dantemss committed May 24, 2022
1 parent 410e323 commit 447ad0f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions db/migrate/20220523181437_fix_foreign_keys.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ def change
StemAnswer.where.not(
Answer.where('"answers"."id" = "stem_answers"."answer_id"').arel.exists
).delete_all

Stem.where.not(
Question.where('"questions"."id" = "stems"."question_id"').arel.exists
).delete_all
end
end

Expand Down

0 comments on commit 447ad0f

Please sign in to comment.