One thing I did that helped a ton was make a “flush” Postgres db branch (same db name just appending _flush to the name) and use that for tests on the code to reset the database state. Otherwise you have to mess around trying to make sure the tests of db resetting happen after all the other tests, and that can be flaky and wind up using hard coded delays or ordering tests, slows things way down.