mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-21 06:21:39 +03:00
0e6e9deac9
https://github.com/hasura/graphql-engine-mono/pull/1606 Co-authored-by: Chris Done <11019+chrisdone@users.noreply.github.com> Co-authored-by: Aniket Deshpande <922486+aniketd@users.noreply.github.com> Co-authored-by: Abby Sassel <3883855+sassela@users.noreply.github.com> GitOrigin-RevId: 2ed37c48c5d1e82e23d691f30a6e870303787388
71 lines
1.9 KiB
YAML
71 lines
1.9 KiB
YAML
# For MySQL, every statement ends with a `;\n` (that's a semicolon followed by a newline), and
|
|
# it cannot parse the next if a new statement follows after an indentation, like we normal write
|
|
# for other backends. So breaking apart the requests into individual statements turned out to be
|
|
# the ergonomic way to make this work.
|
|
# Also tried typical YAML multi-line (block) syntax in all combinations `|`, `>` with `+` and `-`,
|
|
# including specification of the indentation levels with numbers, without success.
|
|
|
|
type: bulk
|
|
args:
|
|
|
|
- type: mysql_run_sql
|
|
args:
|
|
source: mysql
|
|
sql: |
|
|
DROP TABLE IF EXISTS article;
|
|
|
|
- type: mysql_run_sql
|
|
args:
|
|
source: mysql
|
|
sql: |
|
|
DROP TABLE IF EXISTS author;
|
|
|
|
- type: mysql_run_sql
|
|
args:
|
|
source: mysql
|
|
sql: |
|
|
CREATE TABLE author
|
|
(
|
|
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
name VARCHAR(450) UNIQUE KEY,
|
|
createdAt DATETIME
|
|
);
|
|
|
|
- type: mysql_run_sql
|
|
args:
|
|
source: mysql
|
|
sql: |
|
|
INSERT INTO author
|
|
(name, createdAt)
|
|
VALUES
|
|
( 'Author 1', '2017-09-21T09:39:44' ),
|
|
( 'Author 2', '2017-09-21T09:50:44' );
|
|
|
|
|
|
- type: mysql_run_sql
|
|
args:
|
|
source: mysql
|
|
sql: |
|
|
CREATE TABLE article (
|
|
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
title TEXT,
|
|
content TEXT,
|
|
is_published BIT,
|
|
published_on TIMESTAMP,
|
|
author_id INT,
|
|
co_author_id INT,
|
|
FOREIGN KEY (author_id) REFERENCES author(id),
|
|
FOREIGN KEY (co_author_id) REFERENCES author(id)
|
|
);
|
|
|
|
- type: mysql_run_sql
|
|
args:
|
|
source: mysql
|
|
sql: |
|
|
INSERT INTO article
|
|
(title, content, author_id, is_published)
|
|
VALUES
|
|
( 'Article 1', 'Sample article content 1', 1, 0 ),
|
|
( 'Article 2', 'Sample article content 2', 1, 1 ),
|
|
( 'Article 3', 'Sample article content 3', 2, 1 );
|