1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-01 12:24:28 +01:00
fab-manager/db/migrate/20210525150942_remove_transactable_from_wallet_transaction.rb
2021-05-27 11:31:07 +02:00

18 lines
865 B
Ruby

# 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]
def up
remove_reference :wallet_transactions, :transactable, polymorphic: true
end
def down
index_opts = { name: 'index_wallet_transactions_on_transactable'}
add_reference :wallet_transactions, :transactable, polymorphic: true, index: index_opts
end
end