[Django] #24369: flush requires migrations

10 views
Skip to first unread message

Django

unread,
Feb 19, 2015, 9:26:39 AM2/19/15
to django-...@googlegroups.com
#24369: flush requires migrations
-------------------------------+--------------------
Reporter: tanner | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.7
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
./manage flush

raises

RuntimeError: Error creating new content types. Please make sure
contenttypes is migrated before trying to migrate apps individually.

if migrations have not been applied or the database does not yet exist.

I think it should just exit normally in this case.

--
Ticket URL: <https://code.djangoproject.com/ticket/24369>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Feb 21, 2015, 4:04:26 AM2/21/15
to django-...@googlegroups.com
#24369: flush requires migrations
-------------------------------------+-------------------------------------
Reporter: tanner | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Core (Management | Version: 1.7
commands) |
Severity: Normal | Resolution:
Keywords: flush | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by claudep):

* needs_better_patch: => 0
* component: Uncategorized => Core (Management commands)
* needs_tests: => 0
* keywords: => flush
* needs_docs: => 0
* type: Uncategorized => Cleanup/optimization
* stage: Unreviewed => Accepted


Comment:

Suggested change:
{{{ #!diff
diff --git a/django/core/management/commands/flush.py
b/django/core/management/commands/flush.py
index 97c9450..eceb873 100644
--- a/django/core/management/commands/flush.py
+++ b/django/core/management/commands/flush.py
@@ -46,6 +46,10 @@ class Command(BaseCommand):
sql_list = sql_flush(self.style, connection, only_django=True,
reset_sequences=reset_sequences,
allow_cascade=allow_cascade)
+ if not sql_list:
+ raise CommandError(
+ "No commands to proceed with, maybe the database is still
empty?"
+ )

if interactive:
confirm = input("""You have requested a flush of the
database.
}}}

I'm not absolutely convinced about the need to write a test for that...

--
Ticket URL: <https://code.djangoproject.com/ticket/24369#comment:1>

Django

unread,
Feb 25, 2015, 6:36:51 AM2/25/15
to django-...@googlegroups.com
#24369: flush requires migrations
-------------------------------------+-------------------------------------
Reporter: tanner | Owner: nobody

Type: | Status: new
Cleanup/optimization |
Component: Core (Management | Version: 1.7
commands) |
Severity: Normal | Resolution:
Keywords: flush | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by tanner):

looks good. thank you

--
Ticket URL: <https://code.djangoproject.com/ticket/24369#comment:2>

Django

unread,
Feb 25, 2015, 10:59:04 AM2/25/15
to django-...@googlegroups.com
#24369: flush requires migrations
-------------------------------------+-------------------------------------
Reporter: tanner | Owner: nobody

Type: | Status: new
Cleanup/optimization |
Component: Core (Management | Version: 1.7
commands) |
Severity: Normal | Resolution:
Keywords: flush | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by claudep):

* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/24369#comment:3>

Django

unread,
Feb 28, 2015, 4:23:45 AM2/28/15
to django-...@googlegroups.com
#24369: flush requires migrations
-------------------------------------+-------------------------------------
Reporter: tanner | Owner: nobody
Type: | Status: closed

Cleanup/optimization |
Component: Core (Management | Version: 1.7
commands) |
Severity: Normal | Resolution: fixed

Keywords: flush | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Claude Paroz <claude@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"9f1dbe29c0dbae57ff7950f3f64a0d083177cca8"]:
{{{
#!CommitTicketReference repository=""
revision="9f1dbe29c0dbae57ff7950f3f64a0d083177cca8"
Fixed #24369 -- Prevented crash when `flush`ing before db migration

Thanks Thomas Tanner for the report.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24369#comment:4>

Django

unread,
Feb 28, 2015, 6:12:17 AM2/28/15
to django-...@googlegroups.com
#24369: flush requires migrations
-------------------------------------+-------------------------------------
Reporter: tanner | Owner: nobody

Type: | Status: closed
Cleanup/optimization |
Component: Core (Management | Version: 1.7
commands) |
Severity: Normal | Resolution: fixed
Keywords: flush | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Claude Paroz <claude@…>):

In [changeset:"90ab6ee6123f2b378a068988526b409854ddec77"]:
{{{
#!CommitTicketReference repository=""
revision="90ab6ee6123f2b378a068988526b409854ddec77"
Revert "Fixed #24369 -- Prevented crash when `flush`ing before db
migration"

This reverts commit 9f1dbe29c0dbae57ff7950f3f64a0d083177cca8.
The proposed solution does not pass the test suite.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24369#comment:5>

Django

unread,
Feb 28, 2015, 6:14:06 AM2/28/15
to django-...@googlegroups.com
#24369: flush requires migrations
-------------------------------------+-------------------------------------
Reporter: tanner | Owner: nobody
Type: | Status: new

Cleanup/optimization |
Component: Core (Management | Version: 1.7
commands) |
Severity: Normal | Resolution:
Keywords: flush | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by claudep):

* status: closed => new
* resolution: fixed =>


--
Ticket URL: <https://code.djangoproject.com/ticket/24369#comment:6>

Django

unread,
Mar 5, 2015, 2:58:38 AM3/5/15
to django-...@googlegroups.com
#24369: flush requires migrations
-------------------------------------+-------------------------------------
Reporter: tanner | Owner: nobody
Type: | Status: closed

Cleanup/optimization |
Component: Core (Management | Version: 1.7
commands) |
Severity: Normal | Resolution: fixed

Keywords: flush | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Claude Paroz <claude@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"767c33d1fa9827908192e8ed1ac7f281f56bd811"]:
{{{
#!CommitTicketReference repository=""
revision="767c33d1fa9827908192e8ed1ac7f281f56bd811"
Fixed #24369 -- Prevented crash when flushing before db migration

Thanks Thomas Tanner for the report and Tim Graham for the review.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24369#comment:7>

Reply all
Reply to author
Forward
0 new messages