mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 17:31:56 +03:00
c94640a377
* 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
53 lines
1.3 KiB
YAML
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)
|
|
)
|