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
d1d5c97b
Kaydet (Commit)
d1d5c97b
authored
Eyl 25, 2018
tarafından
Oleg
Kaydeden (comit)
Tim Graham
Eyl 25, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #29778 -- Fixed quoting of unique index names.
Regression in
3b429c96
.
üst
86244595
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
1 deletion
+18
-1
schema.py
django/db/backends/base/schema.py
+3
-1
2.1.2.txt
docs/releases/2.1.2.txt
+3
-0
tests.py
tests/schema/tests.py
+12
-0
No files found.
django/db/backends/base/schema.py
Dosyayı görüntüle @
d1d5c97b
...
...
@@ -1013,11 +1013,13 @@ class BaseDatabaseSchemaEditor:
)
def
_create_unique_sql
(
self
,
model
,
columns
):
def
create_unique_name
(
*
args
,
**
kwargs
):
return
self
.
quote_name
(
self
.
_create_index_name
(
*
args
,
**
kwargs
))
table
=
model
.
_meta
.
db_table
return
Statement
(
self
.
sql_create_unique
,
table
=
Table
(
table
,
self
.
quote_name
),
name
=
IndexName
(
table
,
columns
,
'_uniq'
,
self
.
_create_index
_name
),
name
=
IndexName
(
table
,
columns
,
'_uniq'
,
create_unique
_name
),
columns
=
Columns
(
table
,
columns
,
self
.
quote_name
),
)
...
...
docs/releases/2.1.2.txt
Dosyayı görüntüle @
d1d5c97b
...
...
@@ -19,3 +19,6 @@ Bugfixes
(:ticket:`29755`).
* Added compatibility for ``cx_Oracle`` 7 (:ticket:`29759`).
* Fixed a regression in Django 2.0 where unique index names weren't quoted
(:ticket:`29778`).
tests/schema/tests.py
Dosyayı görüntüle @
d1d5c97b
...
...
@@ -1558,6 +1558,18 @@ class SchemaTests(TransactionTestCase):
TagUniqueRename
.
objects
.
create
(
title
=
"bar"
,
slug2
=
"foo"
)
Tag
.
objects
.
all
()
.
delete
()
def
test_unique_name_quoting
(
self
):
old_table_name
=
TagUniqueRename
.
_meta
.
db_table
try
:
with
connection
.
schema_editor
()
as
editor
:
editor
.
create_model
(
TagUniqueRename
)
editor
.
alter_db_table
(
TagUniqueRename
,
old_table_name
,
'unique-table'
)
TagUniqueRename
.
_meta
.
db_table
=
'unique-table'
# This fails if the unique index name isn't quoted.
editor
.
alter_unique_together
(
TagUniqueRename
,
[],
((
'title'
,
'slug2'
),))
finally
:
TagUniqueRename
.
_meta
.
db_table
=
old_table_name
@isolate_apps
(
'schema'
)
@unittest.skipIf
(
connection
.
vendor
==
'sqlite'
,
'SQLite naively remakes the table on field alteration.'
)
@skipUnlessDBFeature
(
'supports_foreign_keys'
)
...
...
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