inspectdb doesn't set the primary_key/unique attribute on mixed case columns
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.
Change History
(6)
Needs tests: |
set
|
Patch needs improvement: |
set
|
Triage Stage: |
Unreviewed → Accepted
|
Component: |
django-admin.py inspectdb → Core (Management commands)
|
Severity: |
→ Normal
|
Type: |
→ Bug
|
Easy pickings: |
unset
|
Keywords: |
inspectdb added
|
UI/UX: |
unset
|
Resolution: |
→ fixed
|
Status: |
new → closed
|
AFAIK this is fixed for some time already.