Mercurial > zeropaste
annotate db/migrate/20180625074738_convert_timestamps_to_with_time_zone.rb @ 505:7236c8864ad2
Remove ZP_ prefix from environment variable names
author | nanaya <me@nanaya.net> |
---|---|
date | Mon, 16 Dec 2024 01:42:54 +0900 |
parents | d2ef59c9a4b4 |
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 = { |
499 | 3 ar_internal_metadata: [ :created_at, :updated_at ], |
4 pastes: [ :created_at, :updated_at ] | |
460
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 |