diff options
Diffstat (limited to 'db')
| -rw-r--r-- | db/migrate/20180425133154_fix_timezones.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/db/migrate/20180425133154_fix_timezones.rb b/db/migrate/20180425133154_fix_timezones.rb new file mode 100644 index 000000000..0e9e5fcb3 --- /dev/null +++ b/db/migrate/20180425133154_fix_timezones.rb @@ -0,0 +1,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 time_zone: convert(s.time_zone) + end + + Chouette::Company.where.not("time_zone LIKE '%/%'").find_each do |c| + c.update time_zone: convert(c.time_zone) + end + end + end +end |
