2020-05-21 18:50:25 +03:00
|
|
|
type: bulk
|
|
|
|
args:
|
2021-01-06 19:06:24 +03:00
|
|
|
|
2020-05-21 18:50:25 +03:00
|
|
|
- type: run_sql
|
|
|
|
args:
|
|
|
|
sql: |
|
|
|
|
CREATE TABLE "user"(
|
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
name TEXT NOT NULL,
|
|
|
|
age INTEGER
|
|
|
|
);
|
2021-09-21 13:39:34 +03:00
|
|
|
CREATE TABLE author(
|
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
name TEXT NOT NULL
|
|
|
|
);
|
|
|
|
CREATE TABLE article(
|
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
title TEXT NOT NULL,
|
|
|
|
content TEXT,
|
|
|
|
author_id INTEGER REFERENCES author(id)
|
|
|
|
);
|
2020-05-21 18:50:25 +03:00
|
|
|
|
|
|
|
- type: track_table
|
|
|
|
args:
|
|
|
|
name: user
|
|
|
|
schema: public
|
|
|
|
- type: create_select_permission
|
|
|
|
args:
|
|
|
|
table: user
|
|
|
|
role: user
|
|
|
|
permission:
|
|
|
|
columns: '*'
|
|
|
|
filter:
|
|
|
|
id: X-Hasura-User-Id
|
2021-09-21 13:39:34 +03:00
|
|
|
|
|
|
|
- type: track_table
|
|
|
|
args:
|
|
|
|
name: author
|
|
|
|
schema: public
|
|
|
|
|
|
|
|
- type: track_table
|
|
|
|
args:
|
|
|
|
name: article
|
|
|
|
schema: public
|
|
|
|
|
|
|
|
- type: create_object_relationship
|
|
|
|
args:
|
|
|
|
table: article
|
|
|
|
name: author
|
|
|
|
using:
|
|
|
|
foreign_key_constraint_on: author_id
|
|
|
|
|
|
|
|
- type: create_array_relationship
|
|
|
|
args:
|
|
|
|
table: author
|
|
|
|
name: articles
|
|
|
|
using:
|
|
|
|
foreign_key_constraint_on:
|
|
|
|
table: article
|
|
|
|
columns: author_id
|