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
328f5627
Unverified
Kaydet (Commit)
328f5627
authored
Eki 21, 2018
tarafından
Mariusz Felisiak
Kaydeden (comit)
GitHub
Eki 21, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #29870 -- Added DurationField introspection for Oracle and PostgreSQL.
Thanks Tim Graham for the review.
üst
19126339
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
26 additions
and
6 deletions
+26
-6
features.py
django/db/backends/base/features.py
+3
-0
features.py
django/db/backends/mysql/features.py
+1
-0
introspection.py
django/db/backends/oracle/introspection.py
+1
-0
introspection.py
django/db/backends/postgresql/introspection.py
+1
-0
features.py
django/db/backends/sqlite3/features.py
+1
-0
2.2.txt
docs/releases/2.2.txt
+7
-0
models.py
tests/introspection/models.py
+1
-0
tests.py
tests/introspection/tests.py
+11
-6
No files found.
django/db/backends/base/features.py
Dosyayı görüntüle @
328f5627
...
@@ -129,6 +129,9 @@ class BaseDatabaseFeatures:
...
@@ -129,6 +129,9 @@ class BaseDatabaseFeatures:
# Can the backend introspect an DecimalField, instead of an FloatField?
# Can the backend introspect an DecimalField, instead of an FloatField?
can_introspect_decimal_field
=
True
can_introspect_decimal_field
=
True
# Can the backend introspect a DurationField, instead of a BigIntegerField?
can_introspect_duration_field
=
True
# Can the backend introspect an IPAddressField, instead of an CharField?
# Can the backend introspect an IPAddressField, instead of an CharField?
can_introspect_ip_address_field
=
False
can_introspect_ip_address_field
=
False
...
...
django/db/backends/mysql/features.py
Dosyayı görüntüle @
328f5627
...
@@ -15,6 +15,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
...
@@ -15,6 +15,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
supports_date_lookup_using_string
=
False
supports_date_lookup_using_string
=
False
can_introspect_autofield
=
True
can_introspect_autofield
=
True
can_introspect_binary_field
=
False
can_introspect_binary_field
=
False
can_introspect_duration_field
=
False
can_introspect_small_integer_field
=
True
can_introspect_small_integer_field
=
True
can_introspect_positive_integer_field
=
True
can_introspect_positive_integer_field
=
True
introspected_boolean_field_type
=
'IntegerField'
introspected_boolean_field_type
=
'IntegerField'
...
...
django/db/backends/oracle/introspection.py
Dosyayı görüntüle @
328f5627
...
@@ -18,6 +18,7 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
...
@@ -18,6 +18,7 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
cx_Oracle
.
DATETIME
:
'DateField'
,
cx_Oracle
.
DATETIME
:
'DateField'
,
cx_Oracle
.
FIXED_CHAR
:
'CharField'
,
cx_Oracle
.
FIXED_CHAR
:
'CharField'
,
cx_Oracle
.
FIXED_NCHAR
:
'CharField'
,
cx_Oracle
.
FIXED_NCHAR
:
'CharField'
,
cx_Oracle
.
INTERVAL
:
'DurationField'
,
cx_Oracle
.
NATIVE_FLOAT
:
'FloatField'
,
cx_Oracle
.
NATIVE_FLOAT
:
'FloatField'
,
cx_Oracle
.
NCHAR
:
'CharField'
,
cx_Oracle
.
NCHAR
:
'CharField'
,
cx_Oracle
.
NCLOB
:
'TextField'
,
cx_Oracle
.
NCLOB
:
'TextField'
,
...
...
django/db/backends/postgresql/introspection.py
Dosyayı görüntüle @
328f5627
...
@@ -22,6 +22,7 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
...
@@ -22,6 +22,7 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
1083
:
'TimeField'
,
1083
:
'TimeField'
,
1114
:
'DateTimeField'
,
1114
:
'DateTimeField'
,
1184
:
'DateTimeField'
,
1184
:
'DateTimeField'
,
1186
:
'DurationField'
,
1266
:
'TimeField'
,
1266
:
'TimeField'
,
1700
:
'DecimalField'
,
1700
:
'DecimalField'
,
2950
:
'UUIDField'
,
2950
:
'UUIDField'
,
...
...
django/db/backends/sqlite3/features.py
Dosyayı görüntüle @
328f5627
...
@@ -15,6 +15,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
...
@@ -15,6 +15,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
supports_mixed_date_datetime_comparisons
=
False
supports_mixed_date_datetime_comparisons
=
False
autocommits_when_autocommit_is_off
=
True
autocommits_when_autocommit_is_off
=
True
can_introspect_decimal_field
=
False
can_introspect_decimal_field
=
False
can_introspect_duration_field
=
False
can_introspect_positive_integer_field
=
True
can_introspect_positive_integer_field
=
True
can_introspect_small_integer_field
=
True
can_introspect_small_integer_field
=
True
supports_transactions
=
True
supports_transactions
=
True
...
...
docs/releases/2.2.txt
Dosyayı görüntüle @
328f5627
...
@@ -182,6 +182,9 @@ Management Commands
...
@@ -182,6 +182,9 @@ Management Commands
* :option:`inspectdb --include-views` now creates models for materialized views
* :option:`inspectdb --include-views` now creates models for materialized views
on PostgreSQL.
on PostgreSQL.
* :djadmin:`inspectdb` now introspects :class:`~django.db.models.DurationField`
for Oracle and PostgreSQL.
Migrations
Migrations
~~~~~~~~~~
~~~~~~~~~~
...
@@ -274,6 +277,10 @@ Database backend API
...
@@ -274,6 +277,10 @@ Database backend API
constraints or uniqueness errors while inserting or set
constraints or uniqueness errors while inserting or set
``DatabaseFeatures.supports_ignore_conflicts`` to ``False``.
``DatabaseFeatures.supports_ignore_conflicts`` to ``False``.
* Third party database backends must implement introspection for
``DurationField`` or set ``DatabaseFeatures.can_introspect_duration_field``
to ``False``.
:mod:`django.contrib.gis`
:mod:`django.contrib.gis`
-------------------------
-------------------------
...
...
tests/introspection/models.py
Dosyayı görüntüle @
328f5627
...
@@ -24,6 +24,7 @@ class Reporter(models.Model):
...
@@ -24,6 +24,7 @@ class Reporter(models.Model):
facebook_user_id
=
models
.
BigIntegerField
(
null
=
True
)
facebook_user_id
=
models
.
BigIntegerField
(
null
=
True
)
raw_data
=
models
.
BinaryField
(
null
=
True
)
raw_data
=
models
.
BinaryField
(
null
=
True
)
small_int
=
models
.
SmallIntegerField
()
small_int
=
models
.
SmallIntegerField
()
interval
=
models
.
DurationField
()
class
Meta
:
class
Meta
:
unique_together
=
(
'first_name'
,
'last_name'
)
unique_together
=
(
'first_name'
,
'last_name'
)
...
...
tests/introspection/tests.py
Dosyayı görüntüle @
328f5627
...
@@ -77,11 +77,16 @@ class IntrospectionTests(TransactionTestCase):
...
@@ -77,11 +77,16 @@ class IntrospectionTests(TransactionTestCase):
desc
=
connection
.
introspection
.
get_table_description
(
cursor
,
Reporter
.
_meta
.
db_table
)
desc
=
connection
.
introspection
.
get_table_description
(
cursor
,
Reporter
.
_meta
.
db_table
)
self
.
assertEqual
(
self
.
assertEqual
(
[
datatype
(
r
[
1
],
r
)
for
r
in
desc
],
[
datatype
(
r
[
1
],
r
)
for
r
in
desc
],
[
'AutoField'
if
connection
.
features
.
can_introspect_autofield
else
'IntegerField'
,
[
'CharField'
,
'CharField'
,
'CharField'
,
'AutoField'
if
connection
.
features
.
can_introspect_autofield
else
'IntegerField'
,
'BigIntegerField'
if
connection
.
features
.
can_introspect_big_integer_field
else
'IntegerField'
,
'CharField'
,
'BinaryField'
if
connection
.
features
.
can_introspect_binary_field
else
'TextField'
,
'CharField'
,
'SmallIntegerField'
if
connection
.
features
.
can_introspect_small_integer_field
else
'IntegerField'
]
'CharField'
,
'BigIntegerField'
if
connection
.
features
.
can_introspect_big_integer_field
else
'IntegerField'
,
'BinaryField'
if
connection
.
features
.
can_introspect_binary_field
else
'TextField'
,
'SmallIntegerField'
if
connection
.
features
.
can_introspect_small_integer_field
else
'IntegerField'
,
'DurationField'
if
connection
.
features
.
can_introspect_duration_field
else
'BigIntegerField'
,
]
)
)
def
test_get_table_description_col_lengths
(
self
):
def
test_get_table_description_col_lengths
(
self
):
...
@@ -98,7 +103,7 @@ class IntrospectionTests(TransactionTestCase):
...
@@ -98,7 +103,7 @@ class IntrospectionTests(TransactionTestCase):
nullable_by_backend
=
connection
.
features
.
interprets_empty_strings_as_nulls
nullable_by_backend
=
connection
.
features
.
interprets_empty_strings_as_nulls
self
.
assertEqual
(
self
.
assertEqual
(
[
r
[
6
]
for
r
in
desc
],
[
r
[
6
]
for
r
in
desc
],
[
False
,
nullable_by_backend
,
nullable_by_backend
,
nullable_by_backend
,
True
,
True
,
False
]
[
False
,
nullable_by_backend
,
nullable_by_backend
,
nullable_by_backend
,
True
,
True
,
False
,
False
]
)
)
@skipUnlessDBFeature
(
'can_introspect_autofield'
)
@skipUnlessDBFeature
(
'can_introspect_autofield'
)
...
...
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