Change ordergroup default in FinancialTransaction to NULL
The AllowEmtpyOrdergroupInFinancialTransaction migration only changed the possibility to store NULL values, but did not set the default to NULL.
This commit is contained in:
parent
7e3c601a25
commit
8cb70d819e
1 changed files with 13 additions and 0 deletions
|
@ -0,0 +1,13 @@
|
||||||
|
class ChangeOrdergroupDefaultInFinancialTransaction < ActiveRecord::Migration
|
||||||
|
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
|
Loading…
Reference in a new issue