Exclude django_session data from DB dumps (#979)#1262
Open
IshanA2007 wants to merge 1 commit into
Open
Conversation
Add --exclude-table-data=django_session to pg_dump in both prod_dump.sh and local_dump.sh. This keeps the django_session table schema but drops its rows, which were bloating the backup (~150MB). The cached_db session backend recreates rows on demand, so restores are unaffected.
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughBoth the local and production database dump scripts were updated to add ChangesDB dump exclusion
Estimated code review effort: 1 (Trivial) | ~2 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
IshanA2007
marked this pull request as ready for review
July 8, 2026 18:53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #979
Problem
DB backups (
latest.dump) were bloated (~150MB) becausepg_dumpincluded thedjango_sessiontable. The app uses thecached_dbsession backend, so sessions are written to Postgres.Fix
Added
--exclude-table-data=django_sessionto thepg_dumpcommand in bothscripts/prod_dump.shandscripts/local_dump.sh. This drops session rows while keeping the table schema, so restores recreate an empty-but-validdjango_session.Verification
bash -non both scripts — clean.scripts/reset-db.shrestore (pg_restore --no-owner,--format=custom) stays compatible; no application code reads session rows directly.Caveats
clearsessionsstep was dropped during the Terraform migration). A scheduledclearsessionsis a reasonable follow-up if live-table growth is a concern.🤖 Implemented with Claude Code.
Summary by CodeRabbit