Opened 10 years ago

Closed 10 years ago

#24369 closed Cleanup/optimization (fixed)

flush requires migrations

Reported by: tanner Owned by: nobody
Component: Core (Management commands) Version: 1.7
Severity: Normal Keywords: flush
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

./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.

Change History (7)

comment:1 by Claude Paroz, 10 years ago

Component: UncategorizedCore (Management commands)
Keywords: flush added
Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization

Suggested change:

  • django/core/management/commands/flush.py

    diff --git a/django/core/management/commands/flush.py b/django/core/management/commands/flush.py
    index 97c9450..eceb873 100644
    a b class Command(BaseCommand):  
    4646        sql_list = sql_flush(self.style, connection, only_django=True,
    4747                             reset_sequences=reset_sequences,
    4848                             allow_cascade=allow_cascade)
     49        if not sql_list:
     50            raise CommandError(
     51                "No commands to proceed with, maybe the database is still empty?"
     52            )
    4953
    5054        if interactive:
    5155            confirm = input("""You have requested a flush of the database.

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

comment:2 by tanner, 10 years ago

looks good. thank you

comment:3 by Claude Paroz, 10 years ago

Has patch: set

comment:4 by Claude Paroz <claude@…>, 10 years ago

Resolution: fixed
Status: newclosed

In 9f1dbe29c0dbae57ff7950f3f64a0d083177cca8:

Fixed #24369 -- Prevented crash when flushing before db migration

Thanks Thomas Tanner for the report.

comment:5 by Claude Paroz <claude@…>, 10 years ago

In 90ab6ee6123f2b378a068988526b409854ddec77:

Revert "Fixed #24369 -- Prevented crash when flushing before db migration"

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

comment:6 by Claude Paroz, 10 years ago

Resolution: fixed
Status: closednew

comment:7 by Claude Paroz <claude@…>, 10 years ago

Resolution: fixed
Status: newclosed

In 767c33d1fa9827908192e8ed1ac7f281f56bd811:

Fixed #24369 -- Prevented crash when flushing before db migration

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

Note: See TracTickets for help on using tickets.
Back to Top