Opened 5 years ago

Closed 4 years ago

Last modified 3 years ago

#31007 closed New feature (fixed)

Make it possible to change the default AutoField to BigAutoField.

Reported by: Caio Ariede Owned by: Tom Forbes
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: Tom Forbes Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This was initially proposed in this comment/PR: https://github.com/django/django/pull/8924#issuecomment-516792989

  1. I really like the proposed approach of having a DEFAULT_AUTOFIELD setting.
  2. For backwards compatibility, when DEFAULT_AUTOFIELD is not set, we should keep the default behavior: django.db.models.AutoField
  3. Whenever this setting is changed, it would affect all existing AND new fields (pk and fk)

Change History (14)

comment:1 by Mariusz Felisiak, 5 years ago

Resolution: wontfix
Status: assignedclosed
Summary: Make it possible to change the default AutoField to BigAutoFieldMake it possible to change the default AutoField to BigAutoField.

I think we need a discussion and consensus on the DevelopersMailingList before we move forward with this ticket. Adding a new setting is always a bit controversial and changing the "default" AutoField for all tables is a complicated and error-prone task. That's why we need a clear path, I'm closing before we finish a discussion.

comment:3 by Tom Forbes, 4 years ago

Cc: Tom Forbes added

comment:4 by Tom Forbes, 4 years ago

Resolution: wontfix
Status: closednew

Re-opening as per the mailing list discussion where we have broad consensus, and a good two-phase plan of action.

comment:5 by Tom Forbes, 4 years ago

Owner: changed from Caio Ariede to Tom Forbes
Status: newassigned

comment:6 by Tom Forbes, 4 years ago

Has patch: set
Needs documentation: set

comment:7 by Carlton Gibson, 4 years ago

Triage Stage: UnreviewedAccepted

comment:8 by Tom Forbes, 4 years ago

Needs documentation: unset

comment:9 by Mariusz Felisiak, 4 years ago

Patch needs improvement: set

comment:10 by Tom Forbes, 4 years ago

Patch needs improvement: unset

Addressed review comments and improved the implementation a bit.

comment:11 by Mariusz Felisiak, 4 years ago

Patch needs improvement: set

comment:12 by Mariusz Felisiak, 4 years ago

Patch needs improvement: unset
Triage Stage: AcceptedReady for checkin

comment:13 by Mariusz Felisiak <felisiak.mariusz@…>, 4 years ago

Resolution: fixed
Status: assignedclosed

In b5e12d49:

Fixed #31007 -- Allowed specifying type of auto-created primary keys.

This also changes the default type of auto-created primary keys
for new apps and projects to BigAutoField.

comment:14 by Mariusz Felisiak <felisiak.mariusz@…>, 3 years ago

In f07723aa:

Refs #31007 -- Added test for check for specifying type of auto-created primary keys from abstract models.

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