Skip to content

feat: read schema from file lists and migration directories - #41

Merged
omer-cengel merged 2 commits into
masterfrom
feature/schema-files-and-migration-directories
Sep 27, 2026
Merged

omer-cengel merged 2 commits into
masterfrom
feature/schema-files-and-migration-directories

Conversation

@omer-cengel

Copy link
Copy Markdown
Member

Summary

sql[].schema now accepts a list of files and directories in addition to a single file, so a query group can read the schema from an existing Flyway-style migration directory instead of a hand-maintained snapshot. Directory contents are read in a deterministic order that matches Flyway versioned migrations, each file is parsed on its own, and failures name the file or directory responsible.

Changes

  • Configuration: sql[].schema is either one path or a non-empty ordered list of paths, each resolved against the configuration file's directory. The single-path form and its diagnostics are unchanged; an empty list and a blank or wrong-typed listed path are rejected with the element named.
  • Source loading: a listed file contributes itself; a directory contributes its regular .sql files (case-sensitive, non-recursive), expanded in place in the list. Versioned V<version>__<description>.sql files come first, compared part by part as numbers (V1, V1_1, V2, V10), followed by the remaining .sql files by name; U<version>__... undo files are ignored. The order does not depend on filesystem listing order.
  • Diagnostics: a directory with duplicate migration versions, a directory with no .sql files, and an unreadable directory each fail with a one-line message naming the directory, before any output is written.
  • Compilation: every schema file is parsed separately and its tables are appended in file order to the entry's schema; a schema syntax or statement error names the file that contains it. A migration directory generates the same repository source as the equivalent single snapshot.
  • Documentation: the configuration reference describes the accepted forms, the directory order, and the failures; the PostgreSQL guide's schema input section links to it.

Scope and non-goals

  • Only CREATE TABLE statements are accepted, as before; no new statements or column types are supported, and a table defined in more than one file is not merged.
  • ALTER/DROP schema evolution, recursive directory scanning, glob patterns, Flyway placeholders, configurable file-name prefixes, and repeatable-migration semantics are not supported.
  • The queries field is unchanged.

@omer-cengel
omer-cengel merged commit 6ae99e0 into master Sep 27, 2026
6 checks passed
@omer-cengel
omer-cengel deleted the feature/schema-files-and-migration-directories branch September 27, 2026 00:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant