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
6e21a594
Kaydet (Commit)
6e21a594
authored
Nis 19, 2013
tarafından
Andrew Godwin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix schema editor interaction with new transactions
üst
7f3678dc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
schema.py
django/db/backends/schema.py
+5
-3
tests.py
tests/schema/tests.py
+1
-1
No files found.
django/db/backends/schema.py
Dosyayı görüntüle @
6e21a594
...
@@ -64,7 +64,9 @@ class BaseDatabaseSchemaEditor(object):
...
@@ -64,7 +64,9 @@ class BaseDatabaseSchemaEditor(object):
Marks the start of a schema-altering run.
Marks the start of a schema-altering run.
"""
"""
self
.
deferred_sql
=
[]
self
.
deferred_sql
=
[]
self
.
connection
.
set_autocommit
(
False
)
self
.
old_autocommit
=
self
.
connection
.
autocommit
if
self
.
connection
.
autocommit
:
self
.
connection
.
set_autocommit
(
False
)
def
commit
(
self
):
def
commit
(
self
):
"""
"""
...
@@ -73,7 +75,7 @@ class BaseDatabaseSchemaEditor(object):
...
@@ -73,7 +75,7 @@ class BaseDatabaseSchemaEditor(object):
for
sql
in
self
.
deferred_sql
:
for
sql
in
self
.
deferred_sql
:
self
.
execute
(
sql
)
self
.
execute
(
sql
)
self
.
connection
.
commit
()
self
.
connection
.
commit
()
self
.
connection
.
set_autocommit
(
True
)
self
.
connection
.
set_autocommit
(
self
.
old_autocommit
)
def
rollback
(
self
):
def
rollback
(
self
):
"""
"""
...
@@ -82,7 +84,7 @@ class BaseDatabaseSchemaEditor(object):
...
@@ -82,7 +84,7 @@ class BaseDatabaseSchemaEditor(object):
if
not
self
.
connection
.
features
.
can_rollback_ddl
:
if
not
self
.
connection
.
features
.
can_rollback_ddl
:
raise
RuntimeError
(
"Cannot rollback schema changes on this backend"
)
raise
RuntimeError
(
"Cannot rollback schema changes on this backend"
)
self
.
connection
.
rollback
()
self
.
connection
.
rollback
()
self
.
connection
.
set_autocommit
(
True
)
self
.
connection
.
set_autocommit
(
self
.
old_autocommit
)
# Core utility functions
# Core utility functions
...
...
tests/schema/tests.py
Dosyayı görüntüle @
6e21a594
...
@@ -453,7 +453,7 @@ class SchemaTests(TransactionTestCase):
...
@@ -453,7 +453,7 @@ class SchemaTests(TransactionTestCase):
Tag
.
objects
.
create
(
title
=
"foo"
,
slug
=
"foo"
)
Tag
.
objects
.
create
(
title
=
"foo"
,
slug
=
"foo"
)
Tag
.
objects
.
create
(
title
=
"bar"
,
slug
=
"foo"
)
Tag
.
objects
.
create
(
title
=
"bar"
,
slug
=
"foo"
)
connection
.
rollback
()
connection
.
rollback
()
# Alter the slug field to be
non-
unique
# Alter the slug field to be unique
new_new_field
=
SlugField
(
unique
=
True
)
new_new_field
=
SlugField
(
unique
=
True
)
new_new_field
.
set_attributes_from_name
(
"slug"
)
new_new_field
.
set_attributes_from_name
(
"slug"
)
editor
=
connection
.
schema_editor
()
editor
=
connection
.
schema_editor
()
...
...
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