manage.py flush raises error if there are unsynchronized applications
|Reported by:||russellm||Owned by:||nobody|
|Component:||Core (Management commands)||Version:||1.0|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
If an application has been added to INSTALLED_APPS, but has not yet been synchronized, ./manage.py flush will raise a "no such table:" error.
How to reproduce:
- Create a new project with a bunch of apps
- Call manage.py syncdb
- Add some new apps to INSTALLED_APPS (e.g., add contrib.admin to the list)
- Call manage.py flush
This will raise an error because the tables for contrib.admin haven't been created, but the flush command will try to delete those tables.
The solution here will be to check the tables that already exist in the database before attempting to destroy them. Syncdb already does a version of this, checking the tables that already exist before trying to create; the same logic needs to be applied to flush.
Change History (8)
comment:1 Changed 7 years ago by russellm
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Accepted