graphql-engine/server/test/testcases/create_tables.yaml
Rakesh Emmadi c94640a377 don't allow creating relationships from/to a table that isn't tracked (fix #185) (#229)
* don't allow fkey based relations from/to a table that isn't tracked, fix #185

Check if remote table exist in metadata when creating foreign-key
based object relationship.

* add tests for adding object relation using fkey if remote table is untracked
2018-08-03 15:04:37 +05:30

53 lines
1.3 KiB
YAML

description: Runs a bulk SQL query to create tables
url: /v1/query
status: 200
query:
type: bulk
args:
- type: run_sql
args:
sql: "CREATE TABLE author (id SERIAL PRIMARY KEY, name TEXT)"
- type: run_sql
args:
sql: |
CREATE TABLE article (
id SERIAL PRIMARY KEY,
title TEXT,
content TEXT,
author_id INTEGER REFERENCES author(id),
is_published BOOLEAN,
published_on TIMESTAMP
)
- type: run_sql
args:
sql: |
CREATE TABLE person (
id SERIAL PRIMARY KEY,
details JSONB NOT NULL
)
- type: run_sql
args:
sql: |
CREATE TABLE dollar$test (
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)
)