mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-18 13:02:11 +03:00
208 lines
7.2 KiB
YAML
208 lines
7.2 KiB
YAML
|
type: bulk
|
||
|
args:
|
||
|
|
||
|
|
||
|
- type: citus_run_sql
|
||
|
args:
|
||
|
source: citus
|
||
|
sql: |
|
||
|
CREATE EXTENSION IF NOT EXISTS ltree;
|
||
|
|
||
|
CREATE TYPE complex AS (
|
||
|
r double precision,
|
||
|
i double precision
|
||
|
);
|
||
|
|
||
|
CREATE TYPE inventory_item AS (
|
||
|
name text,
|
||
|
supplier_id integer,
|
||
|
price numeric
|
||
|
);
|
||
|
|
||
|
SET TIME ZONE 'UTC';
|
||
|
|
||
|
SET lc_monetary TO "en_US.utf-8";
|
||
|
|
||
|
CREATE TABLE test_types (
|
||
|
c1_smallint smallint,
|
||
|
c2_integer integer,
|
||
|
c3_bigint bigint,
|
||
|
c4_decimal decimal(5, 2),
|
||
|
c5_numeric numeric(4, 3),
|
||
|
c6_real real,
|
||
|
c7_double_precision double precision,
|
||
|
c8_smallserial smallserial,
|
||
|
c9_serial serial,
|
||
|
c10_bigserial bigserial,
|
||
|
c11_varchar_3 varchar(3),
|
||
|
c12_char_4 char(4),
|
||
|
c13_text text,
|
||
|
c14_timestamp timestamp,
|
||
|
c15_timestamptz timestamptz,
|
||
|
c16_date date,
|
||
|
c17_time time,
|
||
|
c18_time_with_zone time with time zone,
|
||
|
c19_interval interval,
|
||
|
c20_boolean boolean,
|
||
|
c21_point point,
|
||
|
c22_line line,
|
||
|
c23_lseg lseg,
|
||
|
c24_box box,
|
||
|
c25_closed_path path,
|
||
|
c26_open_path path,
|
||
|
c27_polygon polygon,
|
||
|
c28_circle circle,
|
||
|
c29_cidr cidr,
|
||
|
c30_inet inet,
|
||
|
c31_macaddr macaddr,
|
||
|
c32_json json,
|
||
|
c33_jsonb jsonb,
|
||
|
c34_text_array text[],
|
||
|
c35_integer_2d_array integer[][],
|
||
|
c36_uuid uuid,
|
||
|
c37_composite_type_complex complex,
|
||
|
c38_composite_type_inventory inventory_item,
|
||
|
c39_range_integer int4range,
|
||
|
c40_range_bigint int8range,
|
||
|
c41_range_numeric numrange,
|
||
|
c42_range_timestamp tsrange,
|
||
|
c43_range_timestamptz tstzrange,
|
||
|
c44_xml xml,
|
||
|
c45_money money,
|
||
|
c46_ltree ltree
|
||
|
);
|
||
|
|
||
|
CREATE TABLE author (
|
||
|
id serial PRIMARY KEY,
|
||
|
name text UNIQUE,
|
||
|
"createdAt" timestamp
|
||
|
);
|
||
|
|
||
|
CREATE TABLE article (
|
||
|
id serial PRIMARY KEY,
|
||
|
title text,
|
||
|
content text,
|
||
|
author_id integer REFERENCES author (id),
|
||
|
is_published boolean,
|
||
|
published_on timestamp
|
||
|
);
|
||
|
|
||
|
CREATE TABLE author_multi(
|
||
|
id1 serial,
|
||
|
id2 serial,
|
||
|
name text unique,
|
||
|
"createdAt" timestamp,
|
||
|
PRIMARY KEY (id1, id2)
|
||
|
);
|
||
|
|
||
|
CREATE TABLE article_multi (
|
||
|
id SERIAL PRIMARY KEY,
|
||
|
title TEXT,
|
||
|
content TEXT,
|
||
|
author_id1 INTEGER,
|
||
|
author_id2 INTEGER,
|
||
|
is_published BOOLEAN,
|
||
|
published_on TIMESTAMP,
|
||
|
FOREIGN KEY (author_id1, author_id2) REFERENCES author_multi(id1, id2)
|
||
|
);
|
||
|
|
||
|
INSERT INTO test_types (c1_smallint, c2_integer, c3_bigint, c4_decimal, c5_numeric, c6_real, c7_double_precision, c11_varchar_3, c12_char_4, c13_text, c14_timestamp, c15_timestamptz, c16_date, c17_time, c18_time_with_zone, c19_interval, c20_boolean, c21_point, c22_line, c23_lseg, c24_box, c25_closed_path, c26_open_path, c27_polygon, c28_circle, c29_cidr, c30_inet, c31_macaddr, c32_json, c33_jsonb, c34_text_array, c35_integer_2d_array, c36_uuid, c37_composite_type_complex, c38_composite_type_inventory, c39_range_integer, c40_range_bigint, c41_range_numeric, c42_range_timestamp, c43_range_timestamptz, c44_xml, c45_money, c46_ltree)
|
||
|
VALUES (32767, -- c1_smallint
|
||
|
2147483647, -- c2_integer
|
||
|
9223372036854775807, -- c3_bigint
|
||
|
123.45, -- c4_decimal
|
||
|
1.234, -- c5_numeric
|
||
|
0.00390625, -- c6_real
|
||
|
16.0001220703125, -- c7_double_precision
|
||
|
'abc', -- c11_varchar_3
|
||
|
'baaz', -- c12_char_4
|
||
|
'foo bar baz', -- c13_text
|
||
|
'2004-10-19T10:23:54', -- c14_timestamp
|
||
|
'2015-10-17T14:42:43+00:00', -- c15_timestamptz
|
||
|
'2014-09-14', -- c16_date
|
||
|
'11:09:23', -- c17_time
|
||
|
'15:22:23+00', -- c18_time_with_zone
|
||
|
'01:03:02', -- c19_interval
|
||
|
TRUE, -- c20_boolean
|
||
|
'(1,2)', -- c21_point
|
||
|
'{2,3,-1}', -- c22_line
|
||
|
'[(4,2),(3,1)]', -- c23_line
|
||
|
'((31,12),(14,11))', -- c24_box
|
||
|
'((0,0),(0,3),(1,0))', -- c25_closed_path
|
||
|
'[(0,0),(0,-1),(-3,0)]', -- c26_open_path
|
||
|
'((0,0),(0,6),(2,0))', -- c27_polygon
|
||
|
'<(-2,-3),3>', -- c28_circle
|
||
|
'192.168.100.128/25', -- c29_cidr
|
||
|
'198.24.10.0', -- c30_inet
|
||
|
'08:00:2b:01:02:03', -- c31_macaddr
|
||
|
'{ "a" : "b", "obj": { "c1": "c2" }, "arr": [1, 2, 3], "_underscore": 0, "!@#$%^": "special", "translations": { "hello world!": "hi" }, "objs": [{ "你好": "Hello!" }] }', -- c32_json
|
||
|
'{ "c" : "d", "obj": { "e1": "e2" }, "arr": [4, 5, 6], "_underscore": 0, "!@#$%^": "special", "translations": { "hello world!": "hi" }, "objs": [{ "你好": "Hello!" }] }', -- c33_jsonb
|
||
|
'{"a","b","c"}', -- c34_text_array
|
||
|
'{{4,5,6},{7,8,9}}', -- c35_integer_2d_array
|
||
|
'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11', -- c36_uuid
|
||
|
'(1.23,-3.456)', -- c37_composite_type_complexa
|
||
|
'("fuzzy dice",42,1.99)', -- c38_composite_type_inventory
|
||
|
'[123,456)', -- c39_range_integer
|
||
|
'[1147483647, 2147483647)', -- c40_range_bigint
|
||
|
'[1.23, 4.56]', -- c41_range_numeric
|
||
|
'[2010-01-01 14:30:00, 2010-01-01 15:30:02)', -- c42_range_timestamp
|
||
|
'(2011-02-05T12:03:00+00:00, 2012-03-04T16:40:04+00:00]', -- c43_range_timestamptz
|
||
|
'<foo>bar</foo>', -- c44_xml
|
||
|
123.45, -- c45_money
|
||
|
'A.B.C' -- c46_ltree
|
||
|
);
|
||
|
|
||
|
INSERT INTO author (name, "createdAt")
|
||
|
VALUES ('Author 1', '2017-09-21T09:39:44'), ('Author 2', '2017-09-21T09:50:44');
|
||
|
|
||
|
INSERT INTO article (title, content, author_id, is_published)
|
||
|
VALUES ('Article 1', 'Sample article content 1', 1, FALSE), ('Article 2', 'Sample article content 2', 1, TRUE), ('Article 3', 'Sample article content 3', 2, TRUE);
|
||
|
|
||
|
insert into author_multi (name, "createdAt")
|
||
|
values
|
||
|
('Author 1', '2017-09-21T09:39:44'),
|
||
|
('Author 2', '2017-09-21T09:50:44');
|
||
|
insert into article_multi (title,content,author_id1, author_id2,is_published)
|
||
|
values
|
||
|
(
|
||
|
'Article 1',
|
||
|
'Sample article content 1',
|
||
|
1,
|
||
|
1,
|
||
|
false
|
||
|
),
|
||
|
(
|
||
|
'Article 2',
|
||
|
'Sample article content 2',
|
||
|
1,
|
||
|
1,
|
||
|
true
|
||
|
),
|
||
|
(
|
||
|
'Article 3',
|
||
|
'Sample article content 3',
|
||
|
2,
|
||
|
2,
|
||
|
true
|
||
|
);
|
||
|
CREATE TABLE "user" (
|
||
|
id bigserial PRIMARY KEY,
|
||
|
name text NOT NULL,
|
||
|
number bigint
|
||
|
);
|
||
|
|
||
|
INSERT INTO "user" (name, number)
|
||
|
VALUES ('User 1', 123456789), ('User 2', 123456780);
|
||
|
|
||
|
CREATE EXTENSION IF NOT EXISTS citext;
|
||
|
|
||
|
CREATE TABLE person (
|
||
|
id serial PRIMARY KEY,
|
||
|
name citext
|
||
|
);
|
||
|
|
||
|
INSERT INTO person (name)
|
||
|
VALUES ('John\'),
|
||
|
(' Clarke '),
|
||
|
(' clarke ');
|