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
Extract the repeated apply-time schema glob/read/preprocess/warn loop into a shared helper so command setup and PostgreSQL sqltest seeding use the same schema preprocessing path.
Changes:
- Add `schemautil.LoadSchemasForApply()` to expand schema globs, read files, run `PreprocessSchemaForApply()`, and surface warnings through a caller-provided callback.
- Update `createdb`, `verify`, and managed `vet` setup to reuse the shared loader instead of open-coding the same apply-time preprocessing loop.
- Update PostgreSQL sqltest seeding helpers to reuse the shared loader for both regular and read-only database setup.
- Preserve read-only PostgreSQL fixture cache behavior by hashing the preprocessed DDL returned by the shared loader.
- Leave schema semantics unchanged: unsafe psql meta-commands are still rejected by apply-mode preprocessing, and invalid SQL continues to fail with the database's normal PostgreSQL error.
Behavioral effect:
- Apply-time callers and PostgreSQL test helpers now share one codepath, reducing drift between managed-database setup and sqltest seeding.
- No special-case rewriting of pg_dump `public` schema DDL is performed; callers still see PostgreSQL's native apply-time behavior.
Testing:
- `go test ./internal/migrations ./internal/compiler ./internal/schemautil ./internal/cmd ./internal/sqltest/...`
0 commit comments