Pg_tmp – Run tests on an isolated, temporary PostgreSQL database
A related tip, your unit test fixtures can begin and then rollback a transaction between each test, to retain a pristine database between test runs.The test fixture should run migrations against a test database (used only for test fixtures).