Opened 9 years ago

Closed 7 years ago

#25003 closed Bug (invalid)

schema.tests.SchemaTests.test_alter_implicit_id_to_explicit fails when run in isolation on MySQL

Reported by: Simon Charette Owned by: nobody
Component: Migrations Version: 1.8
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Testing against Django installed in '/usr/src/django/django'
Creating test database for alias 'default'...
Creating test database for alias 'other'...
E
======================================================================
ERROR: test_alter_implicit_id_to_explicit (schema.tests.SchemaTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/src/django/tests/schema/tests.py", line 765, in test_alter_implicit_id_to_explicit
    Author.objects.create(name='Foo')
  File "/usr/src/django/django/db/models/manager.py", line 125, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/src/django/django/db/models/query.py", line 401, in create
    obj.save(force_insert=True, using=self.db)
  File "/usr/src/django/django/db/models/base.py", line 674, in save
    force_update=force_update, update_fields=update_fields)
  File "/usr/src/django/django/db/models/base.py", line 702, in save_base
    updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
  File "/usr/src/django/django/db/models/base.py", line 786, in _save_table
    result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
  File "/usr/src/django/django/db/models/base.py", line 825, in _do_insert
    using=using, raw=raw)
  File "/usr/src/django/django/db/models/manager.py", line 125, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/src/django/django/db/models/query.py", line 1028, in _insert
    return query.get_compiler(using=using).execute_sql(return_id)
  File "/usr/src/django/django/db/models/sql/compiler.py", line 980, in execute_sql
    cursor.execute(sql, params)
  File "/usr/src/django/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/usr/src/django/django/db/utils.py", line 95, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/usr/src/django/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/usr/src/django/django/db/backends/mysql/base.py", line 112, in execute
    return self.cursor.execute(query, args)
  File "/usr/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 220, in execute
    self.errorhandler(self, exc, value)
  File "/usr/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorvalue
OperationalError: (1364, "Field 'id' doesn't have a default value")

----------------------------------------------------------------------
Ran 1 test in 0.156s

FAILED (errors=1)
Destroying test database for alias 'default'...
Destroying test database for alias 'other'...

Change History (2)

comment:1 by Tim Graham, 7 years ago

Component: Testing frameworkMigrations

Simon, are you able to reproduce this? Seems to be working for me on master and the 1.8.x branch. I'm not sure if it might be specific to a particular MySQL version or something.

comment:2 by Simon Charette, 7 years ago

Resolution: invalid
Status: newclosed

I can't reproduce anymore either.

Note: See TracTickets for help on using tickets.
Back to Top