graphql-engine/server/tests-py/queries/graphql_introspection/setup.yaml

108 lines
2.0 KiB
YAML
Raw Normal View History

2018-09-18 09:21:57 +03:00
type: bulk
args:
#Author table
2018-09-18 09:21:57 +03:00
- type: run_sql
args:
sql: |
create table author(
id serial primary key,
name text unique
);
CREATE TABLE article (
id SERIAL PRIMARY KEY,
title TEXT,
content TEXT,
author_id INTEGER NOT NULL REFERENCES author(id),
is_published BOOLEAN NOT NULL default FALSE,
2018-09-18 09:21:57 +03:00
published_on TIMESTAMP
);
- type: track_table
args:
schema: public
name: author
#Article table
2018-09-18 09:21:57 +03:00
- type: track_table
args:
schema: public
name: article
#Object relationship
- type: create_object_relationship
args:
name: author_obj_rel_fk
2018-09-18 09:21:57 +03:00
table: article
using:
foreign_key_constraint_on: author_id
#Object relationship
- type: create_object_relationship
args:
name: author_obj_rel_manual
table: article
using:
manual_configuration:
remote_table:
schema: public
name: author
column_mapping:
author_id: id
2018-09-18 09:21:57 +03:00
#Array relationship
- type: create_array_relationship
args:
table: author
name: articles
using:
foreign_key_constraint_on:
table: article
column: author_id
#Article select permission for user
- type: create_select_permission
args:
table: article
role: user
permission:
columns:
- id
- title
- content
2018-09-18 09:21:57 +03:00
filter:
$or:
- author_id: X-HASURA-USER-ID
- is_published: true
#Article insert permission for user
- type: create_insert_permission
args:
table: article
role: user
permission:
check:
author_id: X-Hasura-User-Id
#Author select permission for user
- type: create_select_permission
args:
table: author
role: user
permission:
columns:
- name
2018-09-18 09:21:57 +03:00
filter:
id: X-HASURA-USER-ID
#Author insert permission for user
- type: create_insert_permission
args:
table: author
role: user
permission:
check:
id: X-HASURA-USER-ID