Skip to content

Dumpdata - does not work (for Meagen)#496

Draft
Stormheg wants to merge 1 commit intomainfrom
fixture-dump
Draft

Dumpdata - does not work (for Meagen)#496
Stormheg wants to merge 1 commit intomainfrom
fixture-dump

Conversation

@Stormheg
Copy link
Member

Missing revisions cause the dump to not restore!

Missing revisions cause the dump to not restore!
@Stormheg
Copy link
Member Author

Cleaning up revisions before dumping using manage.py purge_revisions and including it in the dump helps, but then we get stuck on foreign key references to users that are not part of the dump...

@thibaudcolas thibaudcolas requested a review from Copilot April 2, 2025 21:06
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request introduces a management command to load initial data by wiping out existing data in several models and then reloading from a fixture to address issues with dumpdata not restoring revisions.

  • Clears existing data in models including Site, Page, Permission, Group, and ContentType.
  • Calls the loaddata command to repopulate the database with initial data.
Files not reviewed (1)
  • dumpdata.sh: Language not supported

Comment on lines +19 to +20
ContentType.objects.all().delete()

Copy link

Copilot AI Apr 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleting all ContentType objects may remove essential system metadata that Django uses for content type management, potentially causing downstream issues. Consider targeting only specific ContentType objects that need to be reset or ensure a mechanism to properly regenerate them.

Suggested change
ContentType.objects.all().delete()
ContentType.objects.filter(model__in=['page', 'site', 'permission', 'group']).delete()

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant