Skip to content

Commit

Permalink
Align cascade delete behavior for transfers (#1647)
Browse files Browse the repository at this point in the history
* Align cascade delete behavior for transfers

* Lint fix
  • Loading branch information
zachgoll authored Jan 20, 2025
1 parent 72fd177 commit 67d81f8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
14 changes: 14 additions & 0 deletions db/migrate/20250120210449_align_transfer_cascade_behavior.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class AlignTransferCascadeBehavior < ActiveRecord::Migration[7.2]
def change
remove_foreign_key :transfers, :account_transactions, column: :inflow_transaction_id
remove_foreign_key :transfers, :account_transactions, column: :outflow_transaction_id

add_foreign_key :transfers, :account_transactions,
column: :inflow_transaction_id,
on_delete: :cascade

add_foreign_key :transfers, :account_transactions,
column: :outflow_transaction_id,
on_delete: :cascade
end
end
6 changes: 3 additions & 3 deletions db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 67d81f8

Please sign in to comment.