2021-05-25 17:28:35 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# Following the scheme of the previous migrations, we cannot store anymore a single object as "the bought item"
|
|
|
|
# because wa want to be able to buy multiple items at the same time.
|
|
|
|
# Previously WalletTransaction was saving the item bought using the wallet in transactable columns (polymorphic).
|
|
|
|
# This was limiting to one item only, was redundant with (Invoice|PaymentSchedule).wallet_transaction_id, and anyway
|
|
|
|
# this data was not used anywhere in the application so we remove it.
|
|
|
|
class RemoveTransactableFromWalletTransaction < ActiveRecord::Migration[5.2]
|
2021-05-27 11:31:07 +02:00
|
|
|
def up
|
2021-05-25 17:28:35 +02:00
|
|
|
remove_reference :wallet_transactions, :transactable, polymorphic: true
|
|
|
|
end
|
2021-05-27 11:31:07 +02:00
|
|
|
|
|
|
|
def down
|
|
|
|
index_opts = { name: 'index_wallet_transactions_on_transactable'}
|
|
|
|
add_reference :wallet_transactions, :transactable, polymorphic: true, index: index_opts
|
|
|
|
end
|
2021-05-25 17:28:35 +02:00
|
|
|
end
|