3 ms·
We do the same thing with Microsoft SQL. Each time the hash of our migrations change, we make a new template DB. That takes about 30 seconds to run all our mig
by dagss 2y ago
We do the same thing with Microsoft SQL.
Each time the hash of our migrations change, we make a new template DB. That takes about 30 seconds to run all our migrations..
If the hash didn't change, clone the template of the given hash. This takes less than 1 second.
Some advantages not mentioned in article:
- When developing locally, a new DB clone is made to run my single test interactively. If this took much more than a second I would get rather annoyed.
- Yes a test suite can share a DB for full suite if all tests are written without hardcoding anything and provisiom new IDs always etc. But it is super useful to run a function QueryDump("select * from MyTable") in the test of the code I am working on and the full table dump only having what that single test worked on during debugging, speeds up debugging a lot vs querying for whatever random ID my test allocated.