graphql-engine/server/tests-py/queries/v1/track_table/setup.yaml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

65 lines
1.4 KiB
YAML
Raw Normal View History

type: bulk
args:
- type: run_sql
args:
sql: |
CREATE TABLE author (
id SERIAL PRIMARY KEY,
name TEXT UNIQUE,
remarks TEXT
);
CREATE TABLE article (
id SERIAL PRIMARY KEY,
title TEXT,
author_id INTEGER REFERENCES author(id)
);
CREATE TABLE test1 (
id SERIAL PRIMARY KEY
);
CREATE TABLE test2 (
id SERIAL PRIMARY KEY
);
CREATE TABLE hge_tests.resident (
id SERIAL PRIMARY KEY,
name TEXT NOT NULL,
age INTEGER NOT NULL
);
INSERT INTO author (name) VALUES
('Author 1'),
('Author 2');
INSERT INTO article (title, author_id) VALUES
('Lorem ipsum dolor sit amet', 1),
('lolcats: an anthology', 2),
('consectetur adipiscing elit', 1);
INSERT INTO hge_tests.resident (name, age) VALUES
('Resident 1', 23),
('Resident 2', 31);
CREATE MATERIALIZED VIEW articles AS
SELECT article.title, author.name
FROM article
LEFT JOIN author ON author.id = article.author_id
;
CREATE OR REPLACE FUNCTION test1()
RETURNS SETOF test2 AS $$
SELECT * FROM test2
$$ LANGUAGE sql STABLE;
CREATE TABLE "users address" (
id serial primary key,
user_id int,
address text
);