1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-01 12:24:28 +01:00
fab-manager/db/migrate/20221208123822_rename_accounting_settings.rb
2022-12-21 14:14:37 +01:00

26 lines
1.7 KiB
Ruby

# frozen_string_literal: true
# From this migration some settings related to accounting will be renamed.
# Eg. "accounting_journal_code" will be renamed to "accounting_sales_journal_code"
class RenameAccountingSettings < ActiveRecord::Migration[5.2]
def up
Setting.find_by(name: 'accounting_journal_code')&.update(name: 'accounting_sales_journal_code')
Setting.find_by(name: 'accounting_card_client_code')&.update(name: 'accounting_payment_card_code')
Setting.find_by(name: 'accounting_card_client_label')&.update(name: 'accounting_payment_card_label')
Setting.find_by(name: 'accounting_wallet_client_code')&.update(name: 'accounting_payment_wallet_code')
Setting.find_by(name: 'accounting_wallet_client_label')&.update(name: 'accounting_payment_wallet_label')
Setting.find_by(name: 'accounting_other_client_code')&.update(name: 'accounting_payment_other_code')
Setting.find_by(name: 'accounting_other_client_label')&.update(name: 'accounting_payment_other_label')
end
def down
Setting.find_by(name: 'accounting_sales_journal_code')&.update(name: 'accounting_journal_code')
Setting.find_by(name: 'accounting_payment_card_client_code')&.update(name: 'accounting_card_client_code')
Setting.find_by(name: 'accounting_payment_card_client_label')&.update(name: 'accounting_card_client_label')
Setting.find_by(name: 'accounting_payment_wallet_code')&.update(name: 'accounting_wallet_client_code')
Setting.find_by(name: 'accounting_payment_wallet_label')&.update(name: 'accounting_wallet_client_label')
Setting.find_by(name: 'accounting_payment_other_code')&.update(name: 'accounting_other_client_code')
Setting.find_by(name: 'accounting_payment_other_label')&.update(name: 'accounting_other_client_label')
end
end