blob: 0c854c2513a953f2ddd0ba93ad965a34cb4c2c80 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
class FixTimezones < ActiveRecord::Migration
def convert tz
return unless tz.present?
return tz unless ActiveSupport::TimeZone[tz].present?
ActiveSupport::TimeZone[tz].tzinfo.name
end
def change
if Apartment::Tenant.current == "public"
Chouette::StopArea.where.not("time_zone LIKE '%/%'").find_each do |s|
s.update_column :time_zone, convert(s.time_zone)
end
Chouette::Company.where.not("time_zone LIKE '%/%'").find_each do |c|
c.update_column :time_zone, convert(c.time_zone)
end
end
end
end
|