#25014: Warning about MySQL time format change should not crash migration
----------------------------+--------------------
     Reporter:  fgpietersz  |      Owner:  nobody
         Type:  Bug         |     Status:  new
    Component:  Migrations  |    Version:  1.8
     Severity:  Normal      |   Keywords:
 Triage Stage:  Unreviewed  |  Has patch:  0
Easy pickings:  0           |      UI/UX:  0
----------------------------+--------------------
 When upgrading from MySQL 5.5 to 5.6 the next migration that touches a
 table containing a datetime, timestamp or time field gets a warning:

 {{{

 _mysql_exceptions.Warning: TIME/TIMESTAMP/DATETIME columns of old format
 have been upgraded to the new format.
 }}}


 Unfortunately this causes an exception in MySQLdb, which is not caught, so
 the script exits and the rest of the migration is not run, although the
 changes to the time related fields are made. This could need a fair amount
 of work to clean up if it happens during a complex migration.


 {{{
   File "./manage.py", line 9, in <module>
     execute_from_command_line(sys.argv)
   File "[path-to-virtualenv]/local/lib/python2.7/site-
 packages/django/core/management/__init__.py", line 385, in
 execute_from_command_line
     utility.execute()
   File "[path-to-virtualenv]/local/lib/python2.7/site-
 packages/django/core/management/__init__.py", line 377, in execute
     self.fetch_command(subcommand).run_from_argv(self.argv)
   File "[path-to-virtualenv]/local/lib/python2.7/site-
 packages/django/core/management/base.py", line 288, in run_from_argv
     self.execute(*args, **options.__dict__)
   File "[path-to-virtualenv]/local/lib/python2.7/site-
 packages/django/core/management/base.py", line 338, in execute
     output = self.handle(*args, **options)
   File "[path-to-virtualenv]/local/lib/python2.7/site-
 packages/django/core/management/commands/migrate.py", line 161, in handle
     executor.migrate(targets, plan, fake=options.get("fake", False))
   File "[path-to-virtualenv]/local/lib/python2.7/site-
 packages/django/db/migrations/executor.py", line 68, in migrate
     self.apply_migration(migration, fake=fake)
   File "[path-to-virtualenv]/local/lib/python2.7/site-
 packages/django/db/migrations/executor.py", line 102, in apply_migration
     migration.apply(project_state, schema_editor)
   File "[path-to-virtualenv]/local/lib/python2.7/site-
 packages/django/db/migrations/migration.py", line 108, in apply
     operation.database_forwards(self.app_label, schema_editor,
 project_state, new_state)
   File "[path-to-virtualenv]/local/lib/python2.7/site-
 packages/django/db/migrations/operations/fields.py", line 37, in
 database_forwards
     field,
   File "[path-to-virtualenv]/local/lib/python2.7/site-
 packages/django/db/backends/mysql/schema.py", line 42, in add_field
     super(DatabaseSchemaEditor, self).add_field(model, field)
   File "[path-to-virtualenv]/local/lib/python2.7/site-
 packages/django/db/backends/schema.py", line 388, in add_field
     self.execute(sql, params)
   File "[path-to-virtualenv]/local/lib/python2.7/site-
 packages/django/db/backends/schema.py", line 111, in execute
     cursor.execute(sql, params)
   File "[path-to-virtualenv]/local/lib/python2.7/site-
 packages/django/db/backends/utils.py", line 81, in execute
     return super(CursorDebugWrapper, self).execute(sql, params)
   File "[path-to-virtualenv]/local/lib/python2.7/site-
 packages/django/db/backends/utils.py", line 65, in execute
     return self.cursor.execute(sql, params)
   File "[path-to-virtualenv]/local/lib/python2.7/site-
 packages/django/db/backends/mysql/base.py", line 129, in execute
     return self.cursor.execute(query, args)
   File "[path-to-virtualenv]/local/lib/python2.7/site-
 packages/MySQLdb/cursors.py", line 207, in execute
     if not self._defer_warnings: self._warning_check()
   File "[path-to-virtualenv]/local/lib/python2.7/site-
 packages/MySQLdb/cursors.py", line 117, in _warning_check
     warn(w[-1], self.Warning, 3)
 _mysql_exceptions.Warning: TIME/TIMESTAMP/DATETIME columns of old format
 have been upgraded to the new format.

 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/25014>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/053.2cb9d9c7eb4e059e6c830667f9e62a1e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to