Positional schema definition mutations#2454
Merged
norberttech merged 1 commit intoJun 17, 2026
Merged
Conversation
Add methods to Flow\ETL\Schema for controlling where definitions land, instead of add() only ever appending: - prepend(): insert at the beginning - insertAt(): insert at an explicit index - addBefore() / addAfter(): insert relative to an existing column - moveTo(): relocate an existing column to an index - moveBefore() / moveAfter(): relocate relative to another column - reorder(): reorder by name, keeping unlisted columns in relative order Closes flow-php#2453
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 1.x #2454 +/- ##
============================================
+ Coverage 85.12% 85.13% +0.01%
- Complexity 21162 21186 +24
============================================
Files 1599 1599
Lines 65336 65409 +73
============================================
+ Hits 55614 55686 +72
- Misses 9722 9723 +1 🚀 New features to boost your workflow:
|
norberttech
approved these changes
Jun 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves: #2453
Flow\ETL\Schemapreviously exposed onlyadd(), which always appends definitions to the end of the schema. This PR adds first-class control over where a definition lands, following the existing API conventions (each method mutates$thisand returns it, exactly likeadd()/remove()/rename()).New methods on
Flow\ETL\Schema:prepend(Definition ...$definitions)- insert at the beginninginsertAt(int $index, Definition ...$definitions)- insert at an explicit positionaddBefore(string|Reference $reference, Definition ...$definitions)/addAfter(...)- insert relative to an existing columnmoveTo(string|Reference $name, int $index)- relocate an existing column to an index (preserving its definition/metadata)moveBefore(string|Reference $name, string|Reference $reference)/moveAfter(...)- relocate relative to another columnreorder(string|Reference ...$names)- reorder by name; any unlisted columns keep their relative order and are appendedInserting a definition whose name already exists throws
SchemaDefinitionNotUniqueException(consistent withadd()); an unknown reference throwsSchemaDefinitionNotFoundException(consistent withremove()/rename()/replace()). Because schema column order is observable downstream (e.g. PostgreSQL / Parquet / Doctrine DDL generation), this enables declaratively placing a surrogate/primary-keyidcolumn first - the motivating use case from the issue.Change Log
Added
Flow\ETL\Schema:prepend(),insertAt(),addBefore(),addAfter(),moveTo(),moveBefore(),moveAfter()andreorder()Fixed
Changed
Removed
Deprecated
Security