mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 09:22:43 +03:00
3ba5d1e540
GitOrigin-RevId: 1a0d8fa2b465320e9ab4ea43259d0e8d92364473
82 lines
1.7 KiB
YAML
82 lines
1.7 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
|
|
name: table article in source default
|
|
reason: 'Inconsistent object: no such table/view exists in source: "article"'
|
|
type: table
|
|
- definition:
|
|
using:
|
|
foreign_key_constraint_on:
|
|
column: author_id
|
|
table:
|
|
schema: public
|
|
name: article
|
|
name: articles
|
|
source: default
|
|
comment:
|
|
table:
|
|
schema: public
|
|
name: author
|
|
name: array_relation articles in table author in source default
|
|
reason: >-
|
|
Inconsistent object: 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
|