-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DateTime is not set to UTC on seed's create command #111
Comments
Hi @andrewchen5678 . If your datetime does not store timezone, should seed_dump know about it ? |
How did you solve this bug? When I do the SeedDump.dump it writes the file with the UTC time, without timezone! So when loading it back to the database my app believes they are in app's timezone instead of utc Example: my timezone is America/Santiago (UTC-4) if it is 1 PM in santiago, it is 5 pm in UTC When I Dump it, the date will become 5pm on the file. (which is UTC, but no timezone explicitly set on the file) When importing it, will be inserted as 5pm America santiago which will be 9pm UTC I think the export to the file should include the timezone Like this: 2018-07-11T13:00:00.000-04:00 |
I've experienced the same issue and managed to fix it: You dump records, load seeds, dump again - ALL dates shifted by time zone.
Note key part is: Just place it into I would've submitted PR but it looks like the project is abandoned (but still works), so no use in doing that |
Hi, when I export data with DateTime in postgresql, and import again, the resulting timestamp gets shifted by the timezone offset.
For example, I have an object in the database with last_accessed set to "2016-08-12 02:20:20" in the database, which is UTC timezone, when I run
puts SeedDump.dump(SessionUser.order(id: :desc))
, it becomes this:If I run this to seed data, it becomes last_accessed "2016-08-12 09:20:20" instead in the database when I run it on a machine with pacific timezone.
The text was updated successfully, but these errors were encountered: