Respawn is a database cleaning utility for integration tests that intelligently resets test databases to a clean state by deleting data in the correct order.
The tool solves the problem of test isolation by providing an alternative to transaction rollbacks or post-test deletion. Instead of these approaches, Respawn examines SQL metadata to build a deterministic deletion order based on foreign key relationships between tables. It starts by deleting from tables with no relationships and works inward, ensuring all data is removed without constraint violations. The deletion order is calculated once during initialization and reused across test runs, making the process efficient and predictable.
Respawn suits projects using SQL Server, PostgreSQL, MySQL, or other relational databases where integration tests need a guaranteed clean state before each run. It is particularly valuable when test data might come from external sources or when you need easier debugging and maintenance compared to transaction-based isolation. The tool allows configuration to skip specific tables or schemas that should not be cleared, giving flexibility for shared reference data or system tables.
The project maintains active continuous integration workflows and publishes both stable and development releases. Local development requires Docker to run PostgreSQL and MySQL containers for testing, indicating the tool is tested against multiple database platforms. The codebase is actively maintained with regular updates to support different database systems.