-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add on delete constraint on reference users - comments
- Loading branch information
syl-p
committed
Feb 16, 2024
1 parent
eed9a16
commit dd4eee9
Showing
2 changed files
with
8 additions
and
2 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
db/migrate/20240216103644_add_on_cascade_delete_on_comments.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class AddOnCascadeDeleteOnComments < ActiveRecord::Migration[7.0] | ||
def change | ||
remove_foreign_key :comments, :users | ||
add_foreign_key :comments, :users, on_delete: :cascade | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters