Opened 8 years ago

Closed 4 years ago

#6744 closed Bug (fixed)

inspectdb doesn't set the primary_key/unique attribute on mixed case columns

Reported by: fabiocorneti Owned by: nobody
Component: Core (Management commands) Version: master
Severity: Normal Keywords: inspectdb
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: yes
Easy pickings: no UI/UX: no


I'm trying to use inspectdb with a legacy table like this in a MySQL db:

| Field         | Type         | Null | Key | Default | Extra          |
| idAnagrafica  | int(11)      | NO   | PRI | NULL    | auto_increment | 
| descrizione   | varchar(254) | YES  |     | NULL    |                | 

By default "idAnagrafica" is imported as "idanagrafica" in the resulting model, but it's not designated as the primary key because of the lookup on the schema dictionary is done using the lowercase attribute name.
The attached patch solves the issue for MySQL 5.0.

Attachments (1)

mixedcase_column_attributes.diff (693 bytes) - added by fabiocorneti 8 years ago.

Download all attachments as: .zip

Change History (6)

Changed 8 years ago by fabiocorneti

comment:1 Changed 8 years ago by jacob

  • Needs documentation unset
  • Needs tests set
  • Patch needs improvement set
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 5 years ago by gabrielhurley

  • Component changed from inspectdb to Core (Management commands)

comment:3 Changed 5 years ago by julien

  • Severity set to Normal
  • Type set to Bug

comment:4 Changed 5 years ago by ramiro

  • Easy pickings unset
  • Keywords inspectdb added
  • UI/UX unset

comment:5 Changed 4 years ago by claudep

  • Resolution set to fixed
  • Status changed from new to closed

AFAIK this is fixed for some time already.

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