Skip to content

Add opt-in automatic fixture blocks - #262

Open
xvaara wants to merge 2 commits into
graphile:mainfrom
xvaara:auto-fixture
Open

xvaara wants to merge 2 commits into
graphile:mainfrom
xvaara:auto-fixture

Conversation

@xvaara

@xvaara xvaara commented Sep 19, 2026

Copy link
Copy Markdown

With autoFixtures: true, adding or editing SQL under migrations/fixtures/ automatically adds the changed fixtures to the pending migration. This is an experimental implementation of the fixture-state idea for feedback.

It supports both current.sql and current/, using marked blocks of ordinary --!include directives. Existing entries keep their placement, new entries go into the last block, and manual includes take precedence. Without a block, it appends one to current.sql or creates a final directory file using the project's number width (9-auto-fixtures.sql, 999999-auto-fixtures.sql, etc.).

Fixture discovery includes subdirectories and reuses the existing include compiler and pg-minify. The comparison baseline comes from committed include blocks; hashes are recomputed rather than stored separately. Nested fixtures are included through their outer fixture, and empty blocks retain their placement.

Also preserves include directives after a failed commit and prevents overlapping watch runs while retaining the queued rerun.

Validation: TypeScript build, ESLint, the full Jest suite, and additional current.sql commit/uncommit lifecycle tests. Coverage includes opt-in behavior, new-file discovery, comment-only changes, block placement, filename numbering, and rollback.

@xvaara
xvaara marked this pull request as ready for review September 19, 2026 01:45
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