mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-22 15:01:39 +03:00
89 lines
1.8 KiB
YAML
89 lines
1.8 KiB
YAML
# Setup
|
|
setup:
|
|
type: bulk
|
|
args:
|
|
# tables
|
|
- type: run_sql
|
|
args:
|
|
sql: |
|
|
create table author(
|
|
id serial primary key,
|
|
name text unique
|
|
);
|
|
create table article(
|
|
id serial primary key,
|
|
title text not null,
|
|
content text,
|
|
author_id integer not null references author(id)
|
|
);
|
|
- type: track_table
|
|
args:
|
|
schema: public
|
|
name: author
|
|
- type: track_table
|
|
args:
|
|
schema: public
|
|
name: article
|
|
|
|
#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
|
|
|
|
#SQL to cause inconsistentancy
|
|
sql: drop table article;
|
|
# Inconsistent objects to be returned
|
|
inconsistent_objects:
|
|
- definition:
|
|
schema: public
|
|
name: article
|
|
reason: 'no such table/view exists in postgres: "article"'
|
|
type: table
|
|
- definition:
|
|
using:
|
|
foreign_key_constraint_on: author_id
|
|
name: author
|
|
comment:
|
|
table:
|
|
schema: public
|
|
name: article
|
|
reason: 'table "article" does not exist'
|
|
type: object_relation
|
|
- definition:
|
|
using:
|
|
foreign_key_constraint_on:
|
|
column: author_id
|
|
table:
|
|
schema: public
|
|
name: article
|
|
name: articles
|
|
comment:
|
|
table:
|
|
schema: public
|
|
name: author
|
|
reason: >-
|
|
in table "author": in relationship "articles": table "article" does not exist
|
|
type: array_relation
|
|
|
|
# Teardown
|
|
teardown:
|
|
type: bulk
|
|
args:
|
|
- type: run_sql
|
|
args:
|
|
sql: |
|
|
drop table author
|