﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
25014	Warning about MySQL time format change should not crash migration	Graeme Pietersz	nobody	"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.

}}}
"	Bug	closed	Migrations	1.8	Normal	duplicate			Unreviewed	0	0	0	0	0	0
