Patch #41954 » 0003-Use-UTC-time-for-datetime-column-value.patch
lib/tasks/extract_fixtures.rake | ||
---|---|---|
34 | 34 |
data = ActiveRecord::Base.connection.select_all(sql) |
35 | 35 |
file.write data.inject({}) { |hash, record| |
36 | 36 |
# cast extracted values |
37 |
columns.each { |col| |
|
38 |
record[col.name] = ActiveRecord::Type.lookup(col.type).deserialize(record[col.name]) if record[col.name] |
|
39 |
} |
|
37 |
columns.each do |col| |
|
38 |
if record[col.name] |
|
39 |
record[col.name] = ActiveRecord::Type.lookup(col.type).deserialize(record[col.name]) |
|
40 |
if col.type == :datetime && record[col.name].is_a?(Time) |
|
41 |
record[col.name] = record[col.name].getutc |
|
42 |
end |
|
43 |
end |
|
44 |
end |
|
40 | 45 |
hash["#{table_name}_#{i.succ!}"] = record |
41 | 46 |
hash |
42 | 47 |
}.to_yaml |