Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#26116 closed Bug (fixed)

schema's test_alter_implicit_id_to_explicit warns/errors with "Field 'id' doesn't have a default value" on MySQL

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

Description

On MySQL 5.6.27:

django/db/backends/mysql/base.py:112: Warning: Field 'id' doesn't have a default value
  return self.cursor.execute(query, args)

On MySQL 5.7.10:

IntegrityError: (1364, "Field 'id' doesn't have a default value")

(I guess MySQL is getting stricter about data integrity.)

I'm not sure if it's something Django can fix or if the test should be skipped on MySQL.

Change History (4)

comment:1 by Tim Graham, 9 years ago

Has patch: set
Owner: changed from nobody to Tim Graham
Status: newassigned
Triage Stage: UnreviewedAccepted

I think correcting the test should be sufficient: PR

comment:2 by Tim Graham <timograham@…>, 9 years ago

Resolution: fixed
Status: assignedclosed

In b49cc866:

Fixed #26116 -- Corrected schema's test_alter_implicit_id_to_explicit.

AUTOINCREMENT is dropped converting an AutoField to IntegerField
which isn't the point of this test. MySQL would warn or error about
this.

comment:3 by Tim Graham <timograham@…>, 9 years ago

In 6919586b:

[1.8.x] Fixed #26116 -- Corrected schema's test_alter_implicit_id_to_explicit.

AUTOINCREMENT is dropped converting an AutoField to IntegerField
which isn't the point of this test. MySQL would warn or error about
this.

Backport of b49cc8664306f8b44e9e12ebb9e43791d508ec74 from master

comment:4 by Tim Graham <timograham@…>, 9 years ago

In 1aee5e8:

[1.9.x] Fixed #26116 -- Corrected schema's test_alter_implicit_id_to_explicit.

AUTOINCREMENT is dropped converting an AutoField to IntegerField
which isn't the point of this test. MySQL would warn or error about
this.

Backport of b49cc8664306f8b44e9e12ebb9e43791d508ec74 from master

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