graphql-engine/server/tests-py/queries/inconsistent_objects/test.yaml
Abby Sassel 3ba5d1e540 server: include more detail in inconsistent metadata error messages (fix #6684)
GitOrigin-RevId: 1a0d8fa2b465320e9ab4ea43259d0e8d92364473
2021-05-19 05:02:53 +00:00

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