fix: Support non-public PostgreSQL schemas in resource generator#631
Merged
zachdaniel merged 3 commits intoash-project:mainfrom Oct 5, 2025
Merged
fix: Support non-public PostgreSQL schemas in resource generator#631zachdaniel merged 3 commits intoash-project:mainfrom
zachdaniel merged 3 commits intoash-project:mainfrom
Conversation
- Add schema field to generated resources when table is in non-public schema - Fix SQL queries to use schema-qualified table names for foreign keys and constraints - Update index queries to respect actual schema instead of hardcoded 'public' - Add test coverage for tables in custom schemas with foreign keys and indexes
Fixes crash when generating migrations for resources in non-public schemas where the snapshot directory doesn't exist yet.
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.
This PR fixes the resource generator to properly handle tables in non-public PostgreSQL schemas (e.g.,
inventory.products,ocloud.roles). Previously, the generator would fail when attempting to introspect tables outside thepublicschema. e.g.:Two issues have been fixed:
When generating resources from tables like
ocloud.roles, PostgreSQL queries would fail withERROR 42P01 (undefined_table) relation "roles" does not existbecause unqualified table names were used in introspection queries.After generating resources, the migration generator would crash with
could not list directory "priv/resource_snapshots/repo/roles": no such file or directorybecause it tried to ls snapshot directories based on unqualified table names.The following changes were made:
schema.table) in all PostgreSQL introspection queries for foreign keys, check constraints, and indexesschemaoption to postgres configuration for generated resources when schema is not "public"Contributor checklist
Leave anything that you believe does not apply unchecked.
, or AI was not used in the creation of this PR.(Claude Code assisted in the development of this PR)