We are developing a large application and all our tests are based on a reference Test DB. This test DB is initially loaded by executing different scripts and you can add your own script to add more data.
I want to ease the following flow
- I have loaded the test DB
- I do some data modifications to the DB indirectly (e.g by just using the application)
- I can generate a SQL script of the data modification
I am looking for the most efficient way to do it. So far my best solution is:
- I load the test DB under an other name
- I take a
pg_dump
in sql format of the vanilla test DB and the modified one - I do a diff of both
pg_dump
output
This not really great because:
- Loading test DB takes time and space
- Test DB has some time information which will pollute the diff (e.g tables with
created_date
column)
Any better solution?