一键导入
database-backup
Backup database before tests, migrations, or other database operations
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Backup database before tests, migrations, or other database operations
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Build immersive, scroll-driven websites with GSAP ScrollTrigger, Lenis smooth scroll, parallax effects, and cinematic page transitions. Use when building premium corporate sites, landing pages, or marketing microsites that need motion and polish beyond static designs.
Use when adding docstrings, creating API documentation, or building documentation sites. Invoke for OpenAPI/Swagger specs, JSDoc, doc portals, tutorials, user guides.
Use when reviewing pull requests, conducting code quality audits, or identifying security vulnerabilities. Invoke for PR reviews, code quality checks, refactoring suggestions.
Use when investigating slow queries, analyzing execution plans, or optimizing database performance. Invoke for index design, query rewrites, configuration tuning, partitioning strategies, lock contention resolution.
Use when investigating errors, analyzing stack traces, or finding root causes of unexpected behavior. Invoke for error investigation, troubleshooting, log analysis, root cause analysis.
Use when setting up CI/CD pipelines, containerizing applications, or managing infrastructure as code. Invoke for pipelines, Docker, Kubernetes, cloud platforms, GitOps.
| name | database-backup |
| description | Backup database before tests, migrations, or other database operations |
Create a backup before running any operation that could modify or destroy database data.
Before running:
npm test, pytest, php artisan test)php artisan migrate, prisma migrate)php artisan db:seed)# Create backup
./scripts/backup-database.sh
# Run tests with automatic backup
./scripts/safe-test.sh npm test
# Run migrations with automatic backup
./scripts/safe-migrate.sh php artisan migrate
# Restore if needed
./scripts/restore-database.sh --latest
Real incidents that informed this practice:
migrate:fresh in wrong terminal reset staging databaseA backup takes seconds. Recovery without one can take hours or be impossible.
# Verify which database you're connected to
cat .env | grep DB_
If you see production credentials, stop and switch to a test database.
./scripts/backup-database.sh
Or use the safe wrappers which backup automatically:
./scripts/safe-test.sh [your test command]
./scripts/safe-migrate.sh [your migration command]
After backup is confirmed, proceed with your operation.
If something went wrong:
./scripts/restore-database.sh --latest
| Script | Purpose |
|---|---|
backup-database.sh | Create timestamped backup |
restore-database.sh | Restore from backup |
safe-test.sh | Backup + run tests |
safe-migrate.sh | Backup + run migrations |
See scripts/README.md for detailed usage.
Before database operations:
.env.testing for test database configuration