You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This project currently lacks a test framework for SQL database migration changes.
Our migrations are incremental and are stored in order here: ./tapdb/sqlc/migrations/*.sql
Currently, in testing, we simply apply all migrations and then use the resultant DB. We should add the capability to apply a subset of the migration changes and then allow an opportunity for test code to examine the DB.
The text was updated successfully, but these errors were encountered:
I think we can make this quite simple for us: In NewTestPostgresDB (or NewTestSqliteDB), if an optional initialDataFileName parameter is specified, we would read that file as SQL and run the statements inside against the DB before creating the store (which then applies the migrations).
So if the initial data file contains a full SQL DB dump (including the table that the migrations library uses to keep track of what migrations have already been applied), then we can test certain incremental migrations.
The initial data files might be a bit hard to maintain manually, but ideally we create them from an actual DB once and then don't have to update them.
Maybe we need separate files for Postgres and SQLite, or maybe we can apply the same text search/replace mappings we use during the migrations themselves.
This project currently lacks a test framework for SQL database migration changes.
Our migrations are incremental and are stored in order here:
./tapdb/sqlc/migrations/*.sql
Currently, in testing, we simply apply all migrations and then use the resultant DB. We should add the capability to apply a subset of the migration changes and then allow an opportunity for test code to examine the DB.
The text was updated successfully, but these errors were encountered: