mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-16 09:51:59 +03:00
5bc0355bdd
GitOrigin-RevId: abd7303aaf8e7a8739fd10574249aec450082ef8
54 lines
1.0 KiB
YAML
54 lines
1.0 KiB
YAML
type: bulk
|
|
args:
|
|
|
|
|
|
|
|
- type: run_sql
|
|
args:
|
|
sql: |
|
|
CREATE TABLE author (
|
|
id SERIAL PRIMARY KEY,
|
|
name TEXT NOT NULL,
|
|
age INTEGER
|
|
);
|
|
|
|
INSERT INTO author (name, age) VALUES
|
|
('Clarke', 23),
|
|
('Bellamy', NULL);
|
|
|
|
CREATE TABLE article (
|
|
id SERIAL PRIMARY KEY,
|
|
title TEXT NOT NULL,
|
|
content TEXT,
|
|
author_id INTEGER NOT NULL REFERENCES author(id)
|
|
);
|
|
|
|
INSERT INTO article (title, content, author_id) VALUES
|
|
('Article 1 title', 'Article 1 content', 1),
|
|
('Article 2 title', 'Article 2 content', 2);
|
|
|
|
- type: track_table
|
|
version: 2
|
|
args:
|
|
table: author
|
|
configuration:
|
|
custom_root_fields:
|
|
select: Authors
|
|
custom_column_names:
|
|
id: AuthorId
|
|
|
|
- type: track_table
|
|
version: 2
|
|
args:
|
|
table: article
|
|
configuration: {}
|
|
|
|
- type: create_array_relationship
|
|
args:
|
|
name: articles
|
|
table: author
|
|
using:
|
|
foreign_key_constraint_on:
|
|
table: article
|
|
column: author_id
|