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
478d6a95
Kaydet (Commit)
478d6a95
authored
Ara 30, 2014
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Copied BaseDatabaseCreation._digest() to SchemaEditor to remove dependency.
refs #22340.
üst
93d73dac
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
schema.py
django/db/backends/schema.py
+12
-2
No files found.
django/db/backends/schema.py
Dosyayı görüntüle @
478d6a95
import
hashlib
from
django.db.backends.creation
import
BaseDatabaseCreation
from
django.db.backends.utils
import
truncate_name
from
django.db.models.fields.related
import
ManyToManyField
from
django.db.transaction
import
atomic
...
...
@@ -106,6 +105,17 @@ class BaseDatabaseSchemaEditor(object):
def
quote_name
(
self
,
name
):
return
self
.
connection
.
ops
.
quote_name
(
name
)
@classmethod
def
_digest
(
cls
,
*
args
):
"""
Generates a 32-bit digest of a set of arguments that can be used to
shorten identifying names.
"""
h
=
hashlib
.
md5
()
for
arg
in
args
:
h
.
update
(
force_bytes
(
arg
))
return
h
.
hexdigest
()[:
8
]
# Field <-> database mapping functions
def
column_sql
(
self
,
model
,
field
,
include_default
=
False
):
...
...
@@ -772,7 +782,7 @@ class BaseDatabaseSchemaEditor(object):
# If there is just one column in the index, use a default algorithm from Django
if
len
(
column_names
)
==
1
and
not
suffix
:
return
truncate_name
(
'
%
s_
%
s'
%
(
model
.
_meta
.
db_table
,
BaseDatabaseCreation
.
_digest
(
column_names
[
0
])),
'
%
s_
%
s'
%
(
model
.
_meta
.
db_table
,
self
.
_digest
(
column_names
[
0
])),
self
.
connection
.
ops
.
max_name_length
()
)
# Else generate the name for the index using a different algorithm
...
...
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