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
a3c01b0d
Kaydet (Commit)
a3c01b0d
authored
Eyl 12, 2015
tarafından
Markus Holtermann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #24919 -- Allowed disabling of migrations on a per app basis
üst
ec704371
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
0 deletions
+38
-0
loader.py
django/db/migrations/loader.py
+3
-0
settings.txt
docs/ref/settings.txt
+9
-0
1.9.txt
docs/releases/1.9.txt
+3
-0
test_loader.py
tests/migrations/test_loader.py
+23
-0
No files found.
django/db/migrations/loader.py
Dosyayı görüntüle @
a3c01b0d
...
...
@@ -66,6 +66,9 @@ class MigrationLoader(object):
for
app_config
in
apps
.
get_app_configs
():
# Get the migrations module directory
module_name
=
self
.
migrations_module
(
app_config
.
label
)
if
module_name
is
None
:
self
.
unmigrated_apps
.
add
(
app_config
.
label
)
continue
was_loaded
=
module_name
in
sys
.
modules
try
:
module
=
import_module
(
module_name
)
...
...
docs/ref/settings.txt
Dosyayı görüntüle @
a3c01b0d
...
...
@@ -1862,6 +1862,15 @@ In this case, migrations pertaining to the ``blog`` app will be contained in the
If you provide the ``app_label`` argument, :djadmin:`makemigrations` will
automatically create the package if it doesn't already exist.
.. versionadded:: 1.9
When you supply ``None`` as a value for an app, Django will consider the app as
an app without migrations regardless of an existing ``migrations`` submodule.
This can be used, for example, in a test settings file to skip migrations while
testing (tables will still be created for the apps' models). If this is used in
your general project settings, remember to use the migrate
:djadminopt:`--run-syncdb` option if you want to create tables for the app.
.. setting:: MONTH_DAY_FORMAT
MONTH_DAY_FORMAT
...
...
docs/releases/1.9.txt
Dosyayı görüntüle @
a3c01b0d
...
...
@@ -446,6 +446,9 @@ Migrations
* Added support for serialization of ``functools.partial`` objects.
* When supplying ``None`` as a value in :setting:`MIGRATION_MODULES`, Django
will consider the app an app without migrations.
Models
^^^^^^
...
...
tests/migrations/test_loader.py
Dosyayı görüntüle @
a3c01b0d
...
...
@@ -179,6 +179,29 @@ class LoaderTests(TestCase):
"App missing __init__.py in migrations module not in unmigrated apps."
)
@override_settings
(
INSTALLED_APPS
=
[
'migrations.migrations_test_apps.migrated_app'
],
)
def
test_marked_as_migrated
(
self
):
"""
Undefined MIGRATION_MODULES implies default migration module.
"""
migration_loader
=
MigrationLoader
(
connection
)
self
.
assertEqual
(
migration_loader
.
migrated_apps
,
{
'migrated_app'
})
self
.
assertEqual
(
migration_loader
.
unmigrated_apps
,
set
())
@override_settings
(
INSTALLED_APPS
=
[
'migrations.migrations_test_apps.migrated_app'
],
MIGRATION_MODULES
=
{
"migrated_app"
:
None
},
)
def
test_marked_as_unmigrated
(
self
):
"""
MIGRATION_MODULES allows disabling of migrations for a particular app.
"""
migration_loader
=
MigrationLoader
(
connection
)
self
.
assertEqual
(
migration_loader
.
migrated_apps
,
set
())
self
.
assertEqual
(
migration_loader
.
unmigrated_apps
,
{
'migrated_app'
})
@override_settings
(
MIGRATION_MODULES
=
{
"migrations"
:
"migrations.test_migrations_squashed"
})
def
test_loading_squashed
(
self
):
"Tests loading a squashed migration"
...
...
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