Set match_tenant? on polymorphic references - #231
Merged
zachdaniel merged 1 commit intoSep 18, 2026
Merged
Conversation
The reference map built for a polymorphic relationship never set match_tenant?, so merge_references/3 asked merge_uniq!/4 for a key that was absent, got an empty list, and returned nil. Snapshots normalise the key to false on read, so nil != false made every polymorphic reference compare as changed. The generator then emitted an alter-constraint operation, which on SQLite renders as a migration whose up/0 opens by raising "SQLite does not support dropping foreign key constraints". mix ash.codegen --check reported three pending files on main and the migration it wanted to write could not have run. No snapshot changes: with the key set, the computed references match the committed ones.
C-Sinclair
marked this pull request as ready for review
September 18, 2026 19:43
Contributor
|
🚀 Thank you for your contribution! 🚀 |
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.
mix ash.codegen --checkis currently failing onmainraising"SQLite does not support dropping foreign key constraints.". This one line fixes the issue.I'm not super familiar with how the
match_tenant?flag works, so extra scrutiny required for anything toggling this over would do downstream. But it appears to just be a missed location from 7572718