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
373c6c40
Kaydet (Commit)
373c6c40
authored
Kas 09, 2016
tarafından
Joseph Kahn
Kaydeden (comit)
Tim Graham
Kas 09, 2016
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #27461 -- Fixed incorrect allow_migrate() arguments in makemigrations.
üst
0d6c7cae
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
2 deletions
+15
-2
makemigrations.py
django/core/management/commands/makemigrations.py
+1
-1
1.10.4.txt
docs/releases/1.10.4.txt
+4
-0
test_commands.py
tests/migrations/test_commands.py
+10
-1
No files found.
django/core/management/commands/makemigrations.py
Dosyayı görüntüle @
373c6c40
...
...
@@ -105,7 +105,7 @@ class Command(BaseCommand):
# At least one model must be migrated to the database.
router
.
allow_migrate
(
connection
.
alias
,
app_label
,
model_name
=
model
.
_meta
.
object_name
)
for
app_label
in
consistency_check_labels
for
model
in
apps
.
get_
models
(
app_label
)
for
model
in
apps
.
get_
app_config
(
app_label
)
.
get_models
(
)
)):
loader
.
check_consistent_history
(
connection
)
...
...
docs/releases/1.10.4.txt
Dosyayı görüntüle @
373c6c40
...
...
@@ -12,3 +12,7 @@ Bugfixes
* Quoted the Oracle test user's password in queries to fix the "ORA-00922:
missing or invalid option" error when the password starts with a number or
special character (:ticket:`27420`).
* Fixed incorrect ``app_label`` / ``model_name`` arguments for
``allow_migrate()`` in ``makemigrations`` migration consistency checks
(:ticket:`27461`).
tests/migrations/test_commands.py
Dosyayı görüntüle @
373c6c40
...
...
@@ -598,6 +598,7 @@ class MakeMigrationsTests(MigrationTestBase):
init_file
=
os
.
path
.
join
(
migration_dir
,
'__init__.py'
)
self
.
assertTrue
(
os
.
path
.
exists
(
init_file
))
@override_settings
(
INSTALLED_APPS
=
[
'migrations'
,
'migrations2'
])
def
test_makemigrations_consistency_checks_respect_routers
(
self
):
"""
The history consistency checks in makemigrations respect
...
...
@@ -638,7 +639,15 @@ class MakeMigrationsTests(MigrationTestBase):
with
self
.
settings
(
DATABASE_ROUTERS
=
[
'migrations.routers.TestRouter'
]):
with
mock
.
patch
.
object
(
TestRouter
,
'allow_migrate'
,
return_value
=
False
)
as
allow_migrate
:
call_command
(
'makemigrations'
,
'migrations'
,
verbosity
=
0
)
allow_migrate
.
assert_called_with
(
'other'
,
'migrations'
,
model_name
=
'UnicodeModel'
)
allow_migrate
.
assert_any_call
(
'other'
,
'migrations'
,
model_name
=
'UnicodeModel'
)
# allow_migrate() is called with the correct arguments.
self
.
assertGreater
(
len
(
allow_migrate
.
mock_calls
),
0
)
for
mock_call
in
allow_migrate
.
mock_calls
:
_
,
call_args
,
call_kwargs
=
mock_call
connection_alias
,
app_name
=
call_args
self
.
assertIn
(
connection_alias
,
[
'default'
,
'other'
])
# Raises an error if invalid app_name/model_name occurs.
apps
.
get_app_config
(
app_name
)
.
get_model
(
call_kwargs
[
'model_name'
])
self
.
assertEqual
(
ensure_schema
.
call_count
,
4
)
def
test_failing_migration
(
self
):
...
...
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