这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions server/src-lib/Hasura/RQL/DDL/Relationship.hs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ objRelP2Setup qt (RelDef rn ru _) = do
, SchemaDependency (SOTableObj qt $ TOCol cn) "using_col"
]
refqt = QualifiedTable refsn reftn
void $ askTabInfo refqt
return $ RelInfo rn ObjRel colMapping refqt deps
_ -> throw400 ConstraintError
"more than one foreign key constraint exists on the given column"
Expand Down
1 change: 1 addition & 0 deletions server/test/Spec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ querySpecFiles =
, "track_tables.yaml"
, "create_author_article_relationship.yaml"
, "create_author_article_permissions.yaml"
, "create_address_resident_relationship_error.yaml"
]

gqlSpecFiles :: [FilePath]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
description: Create address to resident object relationship. But resident table is not tracked, so expecting a 400 error
url: /v1/query
status: 400
query:
type: create_object_relationship
args:
table: address
name: resident
using:
foreign_key_constraint_on: resident_id
18 changes: 18 additions & 0 deletions server/test/testcases/create_tables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,21 @@ query:
id SERIAL PRIMARY KEY,
name TEXT NOT NULL
)
- type: run_sql
args:
sql: |
CREATE TABLE resident (
id SERIAL PRIMARY KEY,
name TEXT NOT NULL,
age INTEGER NOT NULL
)
- type: run_sql
args:
sql: |
CREATE TABLE address (
id SERIAL PRIMARY KEY,
door_no TEXT NOT NULL,
street TEXT NOT NULL,
city TEXT NOT NULL,
resident_id INTEGER REFERENCES resident(id)
)
5 changes: 5 additions & 0 deletions server/test/testcases/track_tables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@ query:
args:
schema: public
name: dollar$test
- type: track_table
args:
schema: public
name: address