Repository navigation
fix: upserts and merges use the repo's default prefix - #910
Merged
zachdaniel merged 1 commit intoOct 26, 2026
Merged
Conversation
AshPostgres.Upsert and AshPostgres.Merge build their SQL by hand and took the schema only from opts[:prefix], which is set from the resource's own schema or the tenant. A repo that chooses its schema through default_options/1 had every upsert written to "public" instead, unlike repo.insert_all/3, which applies those options. Both now fall back to repo.default_options(:insert_all)[:prefix].
sean-regents
added a commit
to regents-ai/elixir-utils
that referenced
this pull request
Oct 26, 2026
agents, identity, payments, credits and points depend on regents-ai/ash_postgres at cc886ab3: 2.15.2 plus ash-project/ash_postgres#910, so upserts go to the schema the site's repo picks, and the two 2.13.0 advisories are gone. Ash 3.37.2, ash_sql 0.8.4. credits marks it override because ash_money and ash_double_entry ask for the Hex release. mix check succeeded in all five packages (28, 19, 49, 43 and 4 tests). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sean-regents
added a commit
to regents-ai/ash-template
that referenced
this pull request
Oct 26, 2026
ash_postgres comes from regents-ai/ash_postgres at cc886ab3: the 2.15.2 release plus ash-project/ash_postgres#910, so upserts and Ash.update_many use the Repo's default_options/1 prefix, which picks each site's schema on the shared database. It clears the two advisories on 2.13.0 (EEF-CVE-2026-115635, EEF-CVE-2026-115627). ash_sql 0.8.4. elixir-utils moves to 56fa86bd, where every shared Ash package uses the same copy. - The dead upsert_with_merge? setting goes (2.15.2 has none); the Repo comment says where the prefix comes from. - 2.15.2 ships ash-functions 7, whose ash_required raises its own error instead of calling ash_raise_error, which its empty search_path cannot find. Migration 20261026194117_ash_functions_v7_extensions_1 replaces it. - required-fixes.json lists the copy as a managed library and replaces the == 2.13.0 hold with the git fix 2026-10-26-ash-postgres-upsert-schema; a site on Hex ash_postgres now fails check-required-fixes. - AGENTS.md, docs/dependency-baseline.md, the check script's comment and the release record say the same. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sean-regents
added a commit
to regents-ai/patchbay
that referenced
this pull request
Oct 26, 2026
As in ash-template 07b9188: ash_postgres comes from regents-ai/ash_postgres at cc886ab3, the 2.15.2 release plus ash-project/ash_postgres#910, so upserts and Ash.update_many use the Repo's default_options/1 prefix (Patchbay's own schema on the shared database). It clears EEF-CVE-2026-115635 and EEF-CVE-2026-115627 on 2.13.0; mix hex.audit is clean again. ash_sql 0.8.4. elixir-utils moves e600ed34 -> 56fa86bd (dependency pins only), where every shared Ash package uses the same copy. - Migration 20261026194903_ash_functions_v7_extensions_1 redefines ash_required for ash-functions 7 (the template's body), in the schema from prefix() as every hand-written statement here is; the extensions snapshot moves to version 7. - 2.15.2 records upsert_action in a record's metadata, so the ENS sign-in test compares the account id instead of the whole struct. - The Repo comment says where write prefixes come from; README stack list names Ash 3.37 and AshPostgres 2.15.2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
🚀 Thank you for your contribution! 🚀 |
sean-regents
added a commit
to regents-ai/ash-template
that referenced
this pull request
Oct 27, 2026
Upstream merged ash-project/ash_postgres#910 at 23:24Z, so the template leaves the regents-ai copy for ash-project/ash_postgres main at 55db7d44 (2.15.2 plus #910, #907 and two unique-error mapping fixes), still with override: true until a Hex release carries it. required-fixes: the managed ash_postgres repository and fix 2026-10-26-ash-postgres-upsert-schema name ash-project at 55db7d44; sites on the regents-ai copy fail the check until they move (Keyfleet's kf-ash-upstream 97c3c5b8 is waiting on this). ash_phoenix 2.3.25 -> 2.3.26 and ash_oban 0.10.2 -> 0.10.3, the newest Hex releases, matching Keyfleet main dc1f8140. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sean-regents
added a commit
to regents-ai/patchbay
that referenced
this pull request
Oct 27, 2026
… 0.10.3 ash-project/ash_postgres#910 merged upstream, so Patchbay moves off the regents-ai copy to the same commit ash-template pins and required-fixes now asks for. ash.codegen --check shows no snapshot change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes #909.
AshPostgres.UpsertandAshPostgres.Mergerender their SQL by hand and took the schema only fromopts[:prefix](the resource's schema or the tenant). A repo that chooses its schema withdefault_options/1therefore had upserts and merges written topublic, unlikerepo.insert_all/3, which applies those options. Both builders now fall back torepo.default_options(:insert_all)[:prefix]; an explicit resource schema or tenant still wins.Checked against a project whose repo sets
default_options(_) -> [prefix: "..."]: before, the upsert fails withrelation ... does not exist; after, the row is written to the repo's schema. No test added yet, because the test repos here don't setdefault_options/1. Happy to add a repo and resource for it if you'd like one.Contributor checklist