annotate db/migrate/20180625074738_convert_timestamps_to_with_time_zone.rb @ 487:5246edd5b8ad

Update gems and remove jruby support
author nanaya <me@nanaya.net>
date Tue, 17 Jan 2023 01:42:57 +0900
parents b1ef80121c79
children d2ef59c9a4b4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
460
b1ef80121c79 Update to use correct timestamp datatype
nanaya <me@nanaya.pro>
parents:
diff changeset
1 class ConvertTimestampsToWithTimeZone < ActiveRecord::Migration[5.2]
b1ef80121c79 Update to use correct timestamp datatype
nanaya <me@nanaya.pro>
parents:
diff changeset
2 COLUMNS = {
b1ef80121c79 Update to use correct timestamp datatype
nanaya <me@nanaya.pro>
parents:
diff changeset
3 ar_internal_metadata: [:created_at, :updated_at],
b1ef80121c79 Update to use correct timestamp datatype
nanaya <me@nanaya.pro>
parents:
diff changeset
4 pastes: [:created_at, :updated_at],
b1ef80121c79 Update to use correct timestamp datatype
nanaya <me@nanaya.pro>
parents:
diff changeset
5 }
b1ef80121c79 Update to use correct timestamp datatype
nanaya <me@nanaya.pro>
parents:
diff changeset
6
b1ef80121c79 Update to use correct timestamp datatype
nanaya <me@nanaya.pro>
parents:
diff changeset
7 def up
b1ef80121c79 Update to use correct timestamp datatype
nanaya <me@nanaya.pro>
parents:
diff changeset
8 COLUMNS.each do |table, columns|
b1ef80121c79 Update to use correct timestamp datatype
nanaya <me@nanaya.pro>
parents:
diff changeset
9 change_table table do |t|
b1ef80121c79 Update to use correct timestamp datatype
nanaya <me@nanaya.pro>
parents:
diff changeset
10 columns.each do |column|
b1ef80121c79 Update to use correct timestamp datatype
nanaya <me@nanaya.pro>
parents:
diff changeset
11 t.change column, :timestamptz
b1ef80121c79 Update to use correct timestamp datatype
nanaya <me@nanaya.pro>
parents:
diff changeset
12 end
b1ef80121c79 Update to use correct timestamp datatype
nanaya <me@nanaya.pro>
parents:
diff changeset
13 end
b1ef80121c79 Update to use correct timestamp datatype
nanaya <me@nanaya.pro>
parents:
diff changeset
14 end
b1ef80121c79 Update to use correct timestamp datatype
nanaya <me@nanaya.pro>
parents:
diff changeset
15 end
b1ef80121c79 Update to use correct timestamp datatype
nanaya <me@nanaya.pro>
parents:
diff changeset
16
b1ef80121c79 Update to use correct timestamp datatype
nanaya <me@nanaya.pro>
parents:
diff changeset
17 def down
b1ef80121c79 Update to use correct timestamp datatype
nanaya <me@nanaya.pro>
parents:
diff changeset
18 COLUMNS.each do |table, columns|
b1ef80121c79 Update to use correct timestamp datatype
nanaya <me@nanaya.pro>
parents:
diff changeset
19 change_table table do |t|
b1ef80121c79 Update to use correct timestamp datatype
nanaya <me@nanaya.pro>
parents:
diff changeset
20 columns.each do |column|
b1ef80121c79 Update to use correct timestamp datatype
nanaya <me@nanaya.pro>
parents:
diff changeset
21 t.change column, :timestamp
b1ef80121c79 Update to use correct timestamp datatype
nanaya <me@nanaya.pro>
parents:
diff changeset
22 end
b1ef80121c79 Update to use correct timestamp datatype
nanaya <me@nanaya.pro>
parents:
diff changeset
23 end
b1ef80121c79 Update to use correct timestamp datatype
nanaya <me@nanaya.pro>
parents:
diff changeset
24 end
b1ef80121c79 Update to use correct timestamp datatype
nanaya <me@nanaya.pro>
parents:
diff changeset
25 end
b1ef80121c79 Update to use correct timestamp datatype
nanaya <me@nanaya.pro>
parents:
diff changeset
26 end