Files
graphql-engine/server/tests-py/queries/v1/insert/basic/schema_setup.yaml
Alexis King c0d7402e15 Fix two enum table reference bugs (fix #2820 and #3010) (#3074)
* Include enum types in schema whenever references are visible (fix #2820)
* Fix RQL parsing for nullable enum table references (fix #3010)
2019-10-10 21:22:16 -05:00

99 lines
1.8 KiB
YAML

type: bulk
args:
#Author table
- type: run_sql
args:
sql: |
create table author(
id serial primary key,
name text unique
);
- type: track_table
args:
schema: public
name: author
#Article table
- 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: track_table
args:
schema: public
name: article
#Order table
- type: run_sql
args:
sql: |
CREATE TABLE orders (
id SERIAL PRIMARY KEY,
placed TIMESTAMPTZ NOT NULL,
shipped TIMESTAMPTZ
)
- type: track_table
args:
schema: public
name: orders
#Object relationship
- type: create_object_relationship
args:
table: article
name: author
using:
foreign_key_constraint_on: author_id
#Array relationship
- type: create_array_relationship
args:
table: author
name: articles
using:
foreign_key_constraint_on:
table: article
column: author_id
# Enum table
- type: run_sql
args:
sql: |
CREATE TABLE colors
( value text PRIMARY KEY
, comment text );
INSERT INTO colors (value, comment) VALUES
('red', '#FF0000'),
('green', '#00FF00'),
('blue', '#0000FF'),
('orange', '#FFFF00'),
('yellow', '#00FFFF'),
('purple', '#FF00FF');
CREATE TABLE posts
( id serial PRIMARY KEY
, title text NOT NULL
, custom_color text REFERENCES colors );
- type: track_table
args:
table: colors
is_enum: true
- type: track_table
args: posts
#Set timezone
- type: run_sql
args:
sql: |
SET TIME ZONE 'UTC';