Patch to add a --delete option to loaddata management command
|Reported by:||Graham King <graham@…>||Owned by:||nobody|
|Cc:||Triage Stage:||Design decision needed|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
The attached patch adds a '--delete' option to the loaddata command. This deletes any objects from the database that are not in the fixture. The fixture must contain at least one object of the class for the delete to run.
The result is that loaddata can now insert/update/delete to make a database match the fixture, becoming a sort of 'syncdata' command. A 'dumpdata' followed by 'loaddata --delete' effectively publishes one database onto another. We use this to publish our staging system to live.
The patch contains changes to management/commands/loadata.py, to docs/django-admin.txt and to tests/modeltests/fixtures/models.py. File fixture4.json goes in tests/modeltests/fixtures/fixtures/.
Change History (7)
comment:1 Changed 7 years ago by programmerq
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Design decision needed
comment:3 Changed 7 years ago by russellm
- Resolution set to wontfix
- Status changed from new to closed