Fix payed→payed column rename migration
This commit is contained in:
parent
b7de738866
commit
507010172f
14
stoptime.rb
14
stoptime.rb
|
@ -626,21 +626,11 @@ module StopTime::Models
|
||||||
|
|
||||||
class PaidFlagTypoFix < V 1.9 # :nodoc:
|
class PaidFlagTypoFix < V 1.9 # :nodoc:
|
||||||
def self.up
|
def self.up
|
||||||
add_column(Invoice.table_name, :paid, :boolean)
|
rename_column(Invoice.table_name, :payed, :paid)
|
||||||
Invoice.all.each do |i|
|
|
||||||
i.paid = i.payed unless i.payed.blank?
|
|
||||||
i.save
|
|
||||||
end
|
|
||||||
remove_column(Invoice.table_name, :payed)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.down
|
def self.down
|
||||||
add_column(Invoice.table_name, :payed, :boolean)
|
rename_column(Invoice.table_name, :paid, :payed)
|
||||||
Invoice.all.each do |i|
|
|
||||||
i.payed = i.paid unless i.paid.blank?
|
|
||||||
i.save
|
|
||||||
end
|
|
||||||
remove_column(Invoice.table_name, :paid)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue