Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
c89d80e2
Kaydet (Commit)
c89d80e2
authored
Eyl 12, 2013
tarafından
Michael Manfre
Kaydeden (comit)
Anssi Kääriäinen
Eyl 14, 2013
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #21097 - Added DatabaseFeature.can_introspect_autofield
üst
6feb7512
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
5 deletions
+13
-5
inspectdb.py
django/core/management/commands/inspectdb.py
+5
-2
__init__.py
django/db/backends/__init__.py
+3
-0
tests.py
tests/inspectdb/tests.py
+2
-1
tests.py
tests/introspection/tests.py
+3
-2
No files found.
django/core/management/commands/inspectdb.py
Dosyayı görüntüle @
c89d80e2
...
...
@@ -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.
...
...
django/db/backends/__init__.py
Dosyayı görüntüle @
c89d80e2
...
...
@@ -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
...
...
tests/inspectdb/tests.py
Dosyayı görüntüle @
c89d80e2
...
...
@@ -42,7 +42,8 @@ class InspectDBTestCase(TestCase):
out_def
=
re
.
search
(
r'^\s*
%
s = (models.*)$'
%
name
,
output
,
re
.
MULTILINE
)
.
groups
()[
0
]
self
.
assertEqual
(
definition
,
out_def
)
assertFieldType
(
'id'
,
"models.IntegerField(primary_key=True)"
)
if
not
connection
.
features
.
can_introspect_autofield
:
assertFieldType
(
'id'
,
"models.IntegerField(primary_key=True) # AutoField?"
)
assertFieldType
(
'big_int_field'
,
"models.BigIntegerField()"
)
if
connection
.
vendor
==
'mysql'
:
# No native boolean type on MySQL
...
...
tests/introspection/tests.py
Dosyayı görüntüle @
c89d80e2
...
...
@@ -66,8 +66,9 @@ class IntrospectionTests(TestCase):
# field type on MySQL
self
.
assertEqual
(
[
datatype
(
r
[
1
],
r
)
for
r
in
desc
],
[
'IntegerField'
,
'CharField'
,
'CharField'
,
'CharField'
,
'BigIntegerField'
,
'BinaryField'
if
connection
.
vendor
!=
'mysql'
else
'TextField'
]
[
'AutoField'
if
connection
.
features
.
can_introspect_autofield
else
'IntegerField'
,
'CharField'
,
'CharField'
,
'CharField'
,
'BigIntegerField'
,
'BinaryField'
if
connection
.
vendor
!=
'mysql'
else
'TextField'
]
)
# The following test fails on Oracle due to #17202 (can't correctly
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment