foodsoft/db/migrate/20181201000301_change_ordergroup_default_in_financial_transaction.rb
2020-09-05 14:40:11 +02:00

13 lines
476 B
Ruby

class ChangeOrdergroupDefaultInFinancialTransaction < ActiveRecord::Migration[4.2]
class FinancialTransaction < ActiveRecord::Base; end
def up
change_column_default :financial_transactions, :ordergroup_id, nil
FinancialTransaction.where(ordergroup_id: 0).update_all(ordergroup_id: nil)
end
def down
FinancialTransaction.where(ordergroup_id: nil).update_all(ordergroup_id: 0)
change_column_default :financial_transactions, :ordergroup_id, 0
end
end