diff options
| author | Jon Dufresne <jon.dufresne@gmail.com> | 2019-11-12 19:49:09 -0800 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-11-20 20:42:38 +0100 |
| commit | f5ebdfce5c417f9844e86bccc2f12577064d4bad (patch) | |
| tree | 9e8228bae93ac2ebc0ec9de10baeff8c5793510b /docs/ref | |
| parent | 3e5b349535f011a51dc308898924786143000631 (diff) | |
Fixed #25388 -- Added an option to allow disabling of migrations during test database creation.
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/django-admin.txt | 5 | ||||
| -rw-r--r-- | docs/ref/settings.txt | 19 |
2 files changed, 19 insertions, 5 deletions
diff --git a/docs/ref/django-admin.txt b/docs/ref/django-admin.txt index 8203220159..c08fe44346 100644 --- a/docs/ref/django-admin.txt +++ b/docs/ref/django-admin.txt @@ -1371,8 +1371,9 @@ Preserves the test database between test runs. This has the advantage of skipping both the create and destroy actions which can greatly decrease the time to run tests, especially those in a large test suite. If the test database does not exist, it will be created on the first run and then preserved for each -subsequent run. Any unapplied migrations will also be applied to the test -database before running the test suite. +subsequent run. Unless the :setting:`MIGRATE <TEST_MIGRATE>` test setting is +``False``, any unapplied migrations will also be applied to the test database +before running the test suite. .. django-admin-option:: --reverse, -r diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt index 97b1584765..a32cc4e2a4 100644 --- a/docs/ref/settings.txt +++ b/docs/ref/settings.txt @@ -739,6 +739,17 @@ The creation-order dependencies of the database. See the documentation on :ref:`controlling the creation order of test databases <topics-testing-creation-dependencies>` for details. +.. setting:: TEST_MIGRATE + +``MIGRATE`` +^^^^^^^^^^^ + +.. versionadded:: 3.1 + +Default: ``True`` + +When set to ``False``, migrations won't run when creating the test database. + .. setting:: TEST_MIRROR ``MIRROR`` @@ -2034,9 +2045,11 @@ automatically create the package if it doesn't already exist. 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 :option:`migrate ---run-syncdb` option if you want to create tables for the app. +testing (tables will still be created for the apps' models). To disable +migrations for all apps during tests, you can set the +:setting:`MIGRATE <TEST_MIGRATE>` to ``True`` instead. If ``MIGRATION_MODULES`` +is used in your general project settings, remember to use the +:option:`migrate --run-syncdb` option if you want to create tables for the app. .. setting:: MONTH_DAY_FORMAT |
