mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #25388 -- Added an option to allow disabling of migrations during test database creation.
This commit is contained in:
committed by
Mariusz Felisiak
parent
3e5b349535
commit
f5ebdfce5c
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user