Open
Description
Hi,
I saw the great addition of no versioning and wanted to use that to add testing to our migrations.
However, I would like to test each migration separately and for that I would like to seed the DB for that migration, with one specific migration file, not all files with lower version.
To do that, it seems that there is support for applying a single version with the provider method ApplyVersion
but that method doesn't seem to check the disableVersioning
field and query the DB for existing versions.
My planned test is something like that:
p, err := NewProvider(...)
pNoVersions, err := NewProvider(..., goose.WithDisableVersioning)
// Collect and sort the migrations
for _. m := range sortedMigrations {
// This is where I want to run only a specific seed file
pNoVersions.ApplyVersion(m.Version, true)
p.ApplyVersion(m.Version, true)
// Revert the seed so the next test is isolated from previous ones
pNoVersions.ApplyVersion(m.Version, false)
}
However, I get errors:
- An error since the
goose_db_version
doesn't exist on the first call toApplyVersion
- An error if I want to run a down migration before I revert the seed data, this is because no applied version is found, but this should be fine since I am using a provider with the config
disableVersioning
Metadata
Metadata
Assignees
Labels
No labels