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
45d93baf
Kaydet (Commit)
45d93baf
authored
Ock 22, 2015
tarafından
Markus Holtermann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
[1.8.x] Refs #22962 -- Made test case use non-conflicting table names
Backport of
b06935a4
from master
üst
4c948c7c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
44 deletions
+14
-44
0001_initial.py
...s/postgres_tests/array_default_migrations/0001_initial.py
+1
-41
0002_integerarraymodel_field_2.py
...rray_default_migrations/0002_integerarraymodel_field_2.py
+1
-1
test_array.py
tests/postgres_tests/test_array.py
+12
-2
No files found.
tests/postgres_tests/array_default_migrations/0001_initial.py
Dosyayı görüntüle @
45d93baf
...
...
@@ -12,27 +12,7 @@ class Migration(migrations.Migration):
operations
=
[
migrations
.
CreateModel
(
name
=
'CharArrayModel'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
verbose_name
=
'ID'
,
serialize
=
False
,
auto_created
=
True
,
primary_key
=
True
)),
(
'field'
,
django
.
contrib
.
postgres
.
fields
.
ArrayField
(
models
.
CharField
(
max_length
=
10
),
size
=
None
)),
],
options
=
{
},
bases
=
(
models
.
Model
,),
),
migrations
.
CreateModel
(
name
=
'DateTimeArrayModel'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
verbose_name
=
'ID'
,
serialize
=
False
,
auto_created
=
True
,
primary_key
=
True
)),
(
'field'
,
django
.
contrib
.
postgres
.
fields
.
ArrayField
(
models
.
DateTimeField
(),
size
=
None
)),
],
options
=
{
},
bases
=
(
models
.
Model
,),
),
migrations
.
CreateModel
(
name
=
'IntegerArrayModel'
,
name
=
'IntegerArrayDefaultModel'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
verbose_name
=
'ID'
,
serialize
=
False
,
auto_created
=
True
,
primary_key
=
True
)),
(
'field'
,
django
.
contrib
.
postgres
.
fields
.
ArrayField
(
models
.
IntegerField
(),
size
=
None
)),
...
...
@@ -41,24 +21,4 @@ class Migration(migrations.Migration):
},
bases
=
(
models
.
Model
,),
),
migrations
.
CreateModel
(
name
=
'NestedIntegerArrayModel'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
verbose_name
=
'ID'
,
serialize
=
False
,
auto_created
=
True
,
primary_key
=
True
)),
(
'field'
,
django
.
contrib
.
postgres
.
fields
.
ArrayField
(
django
.
contrib
.
postgres
.
fields
.
ArrayField
(
models
.
IntegerField
(),
size
=
None
),
size
=
None
)),
],
options
=
{
},
bases
=
(
models
.
Model
,),
),
migrations
.
CreateModel
(
name
=
'NullableIntegerArrayModel'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
verbose_name
=
'ID'
,
serialize
=
False
,
auto_created
=
True
,
primary_key
=
True
)),
(
'field'
,
django
.
contrib
.
postgres
.
fields
.
ArrayField
(
models
.
IntegerField
(),
size
=
None
,
null
=
True
,
blank
=
True
)),
],
options
=
{
},
bases
=
(
models
.
Model
,),
),
]
tests/postgres_tests/array_default_migrations/0002_integerarraymodel_field_2.py
Dosyayı görüntüle @
45d93baf
...
...
@@ -13,7 +13,7 @@ class Migration(migrations.Migration):
operations
=
[
migrations
.
AddField
(
model_name
=
'integerarraymodel'
,
model_name
=
'integerarray
default
model'
,
name
=
'field_2'
,
field
=
django
.
contrib
.
postgres
.
fields
.
ArrayField
(
models
.
IntegerField
(),
default
=
[],
size
=
None
),
preserve_default
=
False
,
...
...
tests/postgres_tests/test_array.py
Dosyayı görüntüle @
45d93baf
...
...
@@ -9,7 +9,7 @@ from django.contrib.postgres.forms import SimpleArrayField, SplitArrayField
from
django.core
import
exceptions
,
serializers
from
django.core.management
import
call_command
from
django.db
import
IntegrityError
,
connection
,
models
from
django.test
import
TestCase
,
override_settings
from
django.test
import
TestCase
,
TransactionTestCase
,
override_settings
from
django.utils
import
timezone
from
.models
import
(
...
...
@@ -243,7 +243,9 @@ class TestChecks(TestCase):
self
.
assertEqual
(
errors
[
0
]
.
id
,
'postgres.E002'
)
class
TestMigrations
(
TestCase
):
class
TestMigrations
(
TransactionTestCase
):
available_apps
=
[
'postgres_tests'
]
def
test_deconstruct
(
self
):
field
=
ArrayField
(
models
.
IntegerField
())
...
...
@@ -278,7 +280,15 @@ class TestMigrations(TestCase):
})
def
test_adding_field_with_default
(
self
):
# See #22962
table_name
=
'postgres_tests_integerarraydefaultmodel'
with
connection
.
cursor
()
as
cursor
:
self
.
assertNotIn
(
table_name
,
connection
.
introspection
.
table_names
(
cursor
))
call_command
(
'migrate'
,
'postgres_tests'
,
verbosity
=
0
)
with
connection
.
cursor
()
as
cursor
:
self
.
assertIn
(
table_name
,
connection
.
introspection
.
table_names
(
cursor
))
call_command
(
'migrate'
,
'postgres_tests'
,
'zero'
,
verbosity
=
0
)
with
connection
.
cursor
()
as
cursor
:
self
.
assertNotIn
(
table_name
,
connection
.
introspection
.
table_names
(
cursor
))
@unittest.skipUnless
(
connection
.
vendor
==
'postgresql'
,
'PostgreSQL required'
)
...
...
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