Create an infrastructure for testing migrations of license-DB
Problem to solve
- We need to set up testing for our license-DB database migrations. This involves creating a framework to test both new and existing schema and data migrations.
- We should also create documentation explaining how to use this new infrastructure.
Proposal
-
Use PgTap, PgTAP is a unit testing framework for PostgreSQL, and it operates as an extension of Postgres.
-
An installation guide can be found here, and a video demonstrating examples can be found here.
-
With
PgTap
we can test both schema migrations and data migrations. -
The suggestion is to either create a directory with
PgTap
scripts (written in SQL) or setting up a new schema for unit testing as described here, and then execute the tests usingpg_prove
(further details aboutpg_prove
are provided below).
Edited by Orin Naaman