#34680: inspectdb on mysql timestamp fields leads to timezone issues
-------------------------------------+-------------------------------------
               Reporter:  neilbags   |          Owner:  nobody
                   Type:             |         Status:  new
  Uncategorized                      |
              Component:  Database   |        Version:  4.2
  layer (models, ORM)                |       Keywords:  inspectdb, mysql,
               Severity:  Normal     |  timestamp
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 When using inspectdb on a MySQL database timestamp columns in MySQL are
 generated as DateTime fields in Django models. On the surface this appears
 to work, however, MySQL makes timezone adjustments for timestamps and not
 for datetimes.

 Since Django expects these columns to be datetime, if the server timezone
 is changed, incorrect dates/times are returned. I saw this in the wild
 with
 some created_at and updated_at columns that were created as timestamp
 fields by Laravel.

 I'm not sure if this is something that should be fixed. Maybe the
 inspectdb feature could give a warning when encountering these columns, or
 this could be documented as a caveat in the section on inspectdb and/or
 the howto on dealing with legacy databases.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34680>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070188fa9ce6a4-c2a86777-85f3-43e8-8f71-3f2d9cf876e9-000000%40eu-central-1.amazonses.com.

Reply via email to