Problem
test.db (a SQLite binary file) is committed to the repository root. This causes several issues:
- Security risk: Leaks database schema, table structure, and potentially sensitive test data publicly
- Repository pollution: Binary diffs are unreadable and pollute
git log
- CI conflicts: Multiple CI jobs may race to read/write the same committed file
- Misleading: Suggests the database file should be tracked, confusing contributors
Steps to Reproduce
git ls-files | grep \.db
# outputs: test.db
file test.db
# SQLite 3.x database
Fix
1. Remove from git tracking
git rm --cached test.db
git rm --cached "**/*.db" 2>/dev/null || true
2. Update .gitignore
# Databases
*.db
*.db-shm
*.db-wal
*.sqlite
*.sqlite3
test.db
3. Update CI to use temp directories
# In CI workflow, set DB path to temp dir:
env:
DATABASE_URL: /tmp/test-${{ github.run_id }}.db
TEST_DB_PATH: /tmp/test-${{ github.run_id }}.db
4. Add note in CONTRIBUTING.md
Add a section clarifying:
- Database files are generated at runtime and should never be committed
- Use
npm run db:reset or equivalent to recreate local test DB
- The schema is maintained in migration files, not the binary DB file
5. Add pre-commit hook via Husky
# .husky/pre-commit (add check)
if git diff --cached --name-only | grep -E '\.db$|\.sqlite$'; then
echo "ERROR: Attempting to commit database file. Add *.db to .gitignore."
exit 1
fi
Acceptance Criteria
Problem
test.db(a SQLite binary file) is committed to the repository root. This causes several issues:git logSteps to Reproduce
Fix
1. Remove from git tracking
2. Update
.gitignore3. Update CI to use temp directories
4. Add note in
CONTRIBUTING.mdAdd a section clarifying:
npm run db:resetor equivalent to recreate local test DB5. Add pre-commit hook via Husky
Acceptance Criteria
test.dbremoved from git index viagit rm --cached.gitignoreupdated with*.db,*.sqlite,*.db-shm,*.db-wal