mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
[1.8.x] Fixed #24184 -- Prevented automatic soft-apply of migrations
Previously Django only checked for the table name in CreateModel
operations in initial migrations and faked the migration automatically.
This led to various errors and unexpected behavior. The newly introduced
--fake-initial flag to the migrate command must be passed to get the
same behavior again. With this change Django will bail out in with a
"duplicate relation / table" error instead.
Thanks Carl Meyer and Tim Graham for the documentation update, report
and review.
Backport of f287bec583 from master
This commit is contained in:
@@ -775,6 +775,19 @@ be warned that using ``--fake`` runs the risk of putting the migration state
|
||||
table into a state where manual recovery will be needed to make migrations
|
||||
run correctly.
|
||||
|
||||
.. versionadded:: 1.8
|
||||
|
||||
.. django-admin-option:: --fake-initial
|
||||
|
||||
The ``--fake-initial`` option can be used to allow Django to skip an app's
|
||||
initial migration if all database tables with the names of all models created
|
||||
by all :class:`~django.db.migrations.operations.CreateModel` operations in that
|
||||
migration already exist. This option is intended for use when first running
|
||||
migrations against a database that preexisted the use of migrations. This
|
||||
option does not, however, check for matching database schema beyond matching
|
||||
table names and so is only safe to use if you are confident that your existing
|
||||
schema matches what is recorded in your initial migration.
|
||||
|
||||
.. deprecated:: 1.8
|
||||
|
||||
The ``--list`` option has been moved to the :djadmin:`showmigrations`
|
||||
|
||||
Reference in New Issue
Block a user