Mercurial > zeropaste
annotate db/migrate/20180625074738_convert_timestamps_to_with_time_zone.rb @ 494:e508d3226214 default tip
Update gems
author | nanaya <me@nanaya.net> |
---|---|
date | Sun, 29 Oct 2023 23:24:13 +0900 |
parents | b1ef80121c79 |
children |
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 |