Start using table schema in queries with Postgres#6
Merged
curranosaurus merged 8 commits intomasterfrom Oct 3, 2024
Merged
Conversation
curranosaurus
commented
Oct 2, 2024
| , "AND kcu.table_schema=? " | ||
| , "AND kcu.column_name=? " | ||
| , "AND tc.constraint_name=?" | ||
| ] |
Owner
Author
There was a problem hiding this comment.
This information_schema query change is a non-trivial change to the way Persistent and Postgres integrate. I think that my change is in the spirit of the original, but reviewers should verify for themselves that this makes sense.
6f6c886 to
4b37e1e
Compare
curranosaurus
commented
Oct 2, 2024
| -- allow specifying the schema of the foreign | ||
| -- relation. We need to add the ability to parse | ||
| -- schema=foo directives inline for foreign keys | ||
| -- and insert those values here. |
Owner
Author
There was a problem hiding this comment.
This adds another .persistentmodels parser task.
I inferred that we need to make this change based on the block comment on UnboundForeignDef:
-- | Define an explicit foreign key reference.
--
-- @
-- User
-- name Text
-- email Text
--
-- Primary name email
--
-- Dog
-- ownerName Text
-- ownerEmail Text
--
-- Foreign User fk_dog_user ownerName ownerEmail
-- @
--
-- @since 2.13.0.0
data UnboundForeignDef
Owner
Author
There was a problem hiding this comment.
summarized the task in this ticket: https://linear.app/mercury/issue/INT-848/hackday-persistent-extend-parser-to-allow-schemas-for-fkey-references
Owner
Author
There was a problem hiding this comment.
benjonesy
approved these changes
Oct 3, 2024
…s-migrations Use new entitySchema field for Postgres migrations
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.
I tested this PR by hardcoding
entitySchema = Just $ SchemaNameDB "foo", and it broke the Postgres test suite with the error message "schema foo not found". This means that the schema we specify is making it into the queries we dispatch.