diff options
| author | Michael Manfre <mmanfre@gmail.com> | 2013-09-12 10:03:29 -0400 |
|---|---|---|
| committer | Anssi Kääriäinen <anssi.kaariainen@thl.fi> | 2013-09-14 09:48:59 +0300 |
| commit | c89d80e2cc9bf1f401aa3af4047bdc6f3dc5bfa4 (patch) | |
| tree | 99ebc4210e5e3def22396937b217e99f863bcb0f /django | |
| parent | 6feb75129f42fdac751d0b79a2a005b4c0ad5c2d (diff) | |
Fixed #21097 - Added DatabaseFeature.can_introspect_autofield
Diffstat (limited to 'django')
| -rw-r--r-- | django/core/management/commands/inspectdb.py | 7 | ||||
| -rw-r--r-- | django/db/backends/__init__.py | 3 |
2 files changed, 8 insertions, 2 deletions
diff --git a/django/core/management/commands/inspectdb.py b/django/core/management/commands/inspectdb.py index b4c116acab..89549dc3c1 100644 --- a/django/core/management/commands/inspectdb.py +++ b/django/core/management/commands/inspectdb.py @@ -104,8 +104,11 @@ class Command(NoArgsCommand): # Don't output 'id = meta.AutoField(primary_key=True)', because # that's assumed if it doesn't exist. - if att_name == 'id' and field_type == 'AutoField(' and extra_params == {'primary_key': True}: - continue + if att_name == 'id' and extra_params == {'primary_key': True}: + if field_type == 'AutoField(': + continue + elif field_type == 'IntegerField(' and not connection.features.can_introspect_autofield: + comment_notes.append('AutoField?') # Add 'null' and 'blank', if the 'null_ok' flag was present in the # table description. diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py index d22fea5ec2..44024c5349 100644 --- a/django/db/backends/__init__.py +++ b/django/db/backends/__init__.py @@ -627,6 +627,9 @@ class BaseDatabaseFeatures(object): # which can't do it for MyISAM tables can_introspect_foreign_keys = True + # Can the backend introspect an AutoField, instead of an IntegerField? + can_introspect_autofield = False + # Support for the DISTINCT ON clause can_distinct_on_fields = False |
