mirror of
https://github.com/django/django.git
synced 2025-06-22 20:09:13 +00:00
[1.7.x] Fixed #24054 -- Enabled sqlsequencereset for apps with migrations.
Backport of c2e419c26781b88f2b34b445f450b735267155b0 from master
This commit is contained in:
parent
b9169a100d
commit
1173140dbf
@ -3,7 +3,6 @@ from __future__ import unicode_literals
|
|||||||
from optparse import make_option
|
from optparse import make_option
|
||||||
|
|
||||||
from django.core.management.base import AppCommand
|
from django.core.management.base import AppCommand
|
||||||
from django.core.management.sql import check_for_migrations
|
|
||||||
from django.db import connections, DEFAULT_DB_ALIAS
|
from django.db import connections, DEFAULT_DB_ALIAS
|
||||||
|
|
||||||
|
|
||||||
@ -23,7 +22,6 @@ class Command(AppCommand):
|
|||||||
if app_config.models_module is None:
|
if app_config.models_module is None:
|
||||||
return
|
return
|
||||||
connection = connections[options.get('database')]
|
connection = connections[options.get('database')]
|
||||||
check_for_migrations(app_config, connection)
|
|
||||||
models = app_config.get_models(include_auto_created=True)
|
models = app_config.get_models(include_auto_created=True)
|
||||||
statements = connection.ops.sequence_reset_sql(self.style, models)
|
statements = connection.ops.sequence_reset_sql(self.style, models)
|
||||||
return '\n'.join(statements)
|
return '\n'.join(statements)
|
||||||
|
@ -167,3 +167,6 @@ Bugfixes
|
|||||||
instead of ``DeleteModel`` and ``CreateModel`` operations when changing
|
instead of ``DeleteModel`` and ``CreateModel`` operations when changing
|
||||||
``Meta.managed``. This prevents data loss when changing ``managed`` from
|
``Meta.managed``. This prevents data loss when changing ``managed`` from
|
||||||
``False`` to ``True`` and vice versa (:ticket:`24037`).
|
``False`` to ``True`` and vice versa (:ticket:`24037`).
|
||||||
|
|
||||||
|
* Enabled the ``sqlsequencereset`` command on apps with migrations
|
||||||
|
(:ticket:`24054`).
|
||||||
|
Loading…
x
Reference in New Issue
Block a user