From 25a86a78850fd21c5a7a07dd72f565cf954b6fe8 Mon Sep 17 00:00:00 2001 From: Evan Senter Date: Fri, 2 Jan 2026 05:03:37 +0000 Subject: [PATCH] docs: Add database backup guidance before schema migrations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Migrations can have subtle bugs (race conditions, data transform issues) that corrupt data irreversibly. Always back up before schema changes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- CLAUDE.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CLAUDE.md b/CLAUDE.md index ad76338..2cdca86 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -46,6 +46,13 @@ Key components: - `make uninstall` - OK, preserves database (only removes LaunchAgent + MCP config) - `make reinstall` - OK, just reinstalls Python package +### Before schema/migration changes: +**ALWAYS back up the database before making schema or migration changes:** +```bash +cp ~/.claude/contrib/analytics/data.db ~/.claude/contrib/analytics/data.db.backup-$(date +%Y%m%d-%H%M%S) +``` +Migrations can have subtle bugs (race conditions, incorrect data transforms) that corrupt data irreversibly. + ### If you need to test destructive operations: Use a temporary database in tests (all tests already do this via `tmpdir`).