mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-21 06:21:39 +03:00
1843ee7b0b
https://github.com/hasura/graphql-engine-mono/pull/2239 Co-authored-by: Gil Mizrahi <8547573+soupi@users.noreply.github.com> Co-authored-by: Rakesh Emmadi <12475069+rakeshkky@users.noreply.github.com> GitOrigin-RevId: fabc825239950b11d673cfd33e8075a01409bcf6
61 lines
1.1 KiB
YAML
61 lines
1.1 KiB
YAML
type: bulk
|
|
args:
|
|
|
|
- type: run_sql
|
|
args:
|
|
sql: |
|
|
CREATE TABLE "user"(
|
|
id SERIAL PRIMARY KEY,
|
|
name TEXT NOT NULL,
|
|
age INTEGER
|
|
);
|
|
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)
|
|
);
|
|
|
|
- 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
|
|
|
|
- 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
|