graphql-engine/server/tests-py/queries/inconsistent_objects/test.yaml
Antoine Leblanc 8b0b4e5c35 Remove all functions from RQL.Types.hs
## Description

This small PR moves all functions in `RQL.Types.hs` to better locations. Most `askX` functions are moved alongside the `unsafe` functions they use. Several other functions are moved closer to their call site. `MetadataM` is moved alongside `Metadata`. This PR also documents the `ask` functions.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4355
GitOrigin-RevId: 0498a7e8f98e7a94af911dd375cad84ace7ddffa
2022-04-26 15:13:57 +00:00

82 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
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 in source: default
type: array_relation
# Teardown
teardown:
type: bulk
args:
- type: run_sql
args:
sql: |
drop table author