graphql-engine/v3/crates/engine/tests/db_definition.sql

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

166 lines
4.1 KiB
MySQL
Raw Normal View History

/*****************************************
Non chinook tables
******************************************/
CREATE TABLE public.article (
id integer NOT NULL,
title text,
author_id integer,
CONSTRAINT article_pkey PRIMARY KEY (id)
);
COPY public.article (id, title, author_id) FROM stdin;
1 The Next 700 Programming Languages 1
2 Why Functional Programming Matters 2
3 The Design And Implementation Of Programming Languages 2
fix: remote joins bug with nested selections (#371) ## Description This PR fixes a bug when remote joins is used within nested selections. The bug is described in #318 Closes: https://hasurahq.atlassian.net/browse/V3ENGINE-20 The fix is to remove the replacement tokens data type. And instead use each `Argument` as the key to lookup in RHS response and join with LHS response. <!-- Questions to consider answering: 1. What user-facing changes are being made? 2. What are issues related to this PR? (Consider adding `(close #<issue-no>)` to the PR title) 3. What is the conceptual design behind this PR? 4. How can this PR be tested/verified? 5. Does the PR have limitations? 6. Does the PR introduce breaking changes? --> ## Changelog - Add a changelog entry (in the "Changelog entry" section below) if the changes in this PR have any user-facing impact. See [changelog guide](https://github.com/hasura/graphql-engine-mono/wiki/Changelog-Guide). - If no changelog is required ignore/remove this section and add a `no-changelog-required` label to the PR. ### Product _(Select all products this will be available in)_ - [x] community-edition - [x] cloud <!-- product : end : DO NOT REMOVE --> ### Type <!-- See changelog structure: https://github.com/hasura/graphql-engine-mono/wiki/Changelog-Guide#structure-of-our-changelog --> _(Select only one. In case of multiple, choose the most appropriate)_ - [ ] highlight - [ ] enhancement - [x] bugfix - [ ] behaviour-change - [ ] performance-enhancement - [ ] security-fix <!-- type : end : DO NOT REMOVE --> ### Changelog entry <!-- - Add a user understandable changelog entry - Include all details needed to understand the change. Try including links to docs or issues if relevant - For Highlights start with a H4 heading (#### <entry title>) - Get the changelog entry reviewed by your team --> Fix bug when remote joins are used within nested selections <!-- changelog-entry : end : DO NOT REMOVE --> <!-- changelog : end : DO NOT REMOVE --> --------- Co-authored-by: Gil Mizrahi <gil@hasura.io> V3_GIT_ORIGIN_REV_ID: 3c0648f5fb21eb4f1d6cc004db2f3ee61a731c38
2024-03-20 20:49:34 +03:00
4 The Mechanical Evaluation of Expressions 1
5 Generalizing monads to arrows 2
\.
CREATE TABLE author (
id integer NOT NULL,
first_name text,
last_name text,
CONSTRAINT author_pkey PRIMARY KEY (id)
);
COPY public.author (id, first_name, last_name) FROM stdin;
1 Peter Landin
2 John Hughes
\.
CREATE TABLE public.movie_analytics (
id integer NOT NULL,
movie_id integer NOT NULL,
num_votes_day integer,
num_views_day integer,
num_users_faved integer,
num_users_watchlisted integer,
total_votes integer,
prev_day_scores integer,
movie_name text
);
CREATE SEQUENCE public.movie_analytics_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.movie_analytics_id_seq OWNER TO postgres;
--
-- Data for Name: movie_analytics; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.movie_analytics (id, movie_id, num_votes_day, num_views_day, num_users_faved, num_users_watchlisted, total_votes, prev_day_scores, movie_name) FROM stdin;
1 1 10 22 9 11 578 8 Titanic
2 2 8 13 4 3 432 7 Slumdog Millionaire
3 3 17 34 14 11 849 9 Godfather
\.
--
-- Name: movie_analytics movie_analytics_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.movie_analytics
ADD CONSTRAINT movie_analytics_pkey PRIMARY KEY (id);
--
-- Name: article FK_article_author_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
--
-- Name: movie_analytics_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.movie_analytics_id_seq', 3, true);
--
-- Name: article article_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
--
-- Name: movie_analytics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.movie_analytics_id_seq OWNED BY public.movie_analytics.id;
--
-- Name: movie_analytics id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.movie_analytics ALTER COLUMN id SET DEFAULT nextval('public.movie_analytics_id_seq'::regclass);
-- `institution` table for testing queries into JSON objects
CREATE TYPE public.country AS (name text, continent text);
CREATE TYPE public.location AS (city text, country country, campuses text []);
CREATE TYPE public.staff AS (
first_name text,
last_name text,
specialities text [],
favourite_artist_id int
);
CREATE TABLE public.institution (
id integer NOT NULL,
name text,
location location,
staff staff [],
departments text [],
CONSTRAINT institution_pkey PRIMARY KEY (id)
);
INSERT INTO public.institution (id, name, location, staff, departments)
VALUES (
1,
'Queen Mary University of London',
ROW(
'London',
ROW('UK','Europe') :: country,
ARRAY ['Mile End','Whitechapel','Charterhouse Square','West Smithfield']
)::location,
ARRAY [ROW('Peter','Landin',ARRAY['Computer Science','Education'],
1
)::staff ],
ARRAY ['Humanities and Social Sciences','Science and Engineering','Medicine and Dentistry']
),
(
2,
'Chalmers University of Technology',
ROW(
'Gothenburg',
ROW('Sweden','Europe') :: country,
ARRAY ['Johanneberg','Lindholmen']
)::location,
ARRAY [ROW('John','Hughes',ARRAY['Computer Science','Functional Programming','Software Testing'],
2
)::staff,
ROW(
'Koen',
'Claessen',
ARRAY ['Computer Science','Functional Programming','Automated Reasoning'],
3
)::staff ],
ARRAY ['Architecture and Civil Engineering','Computer Science and Engineering','Electrical Engineering','Physics','Industrial and Materials Science']
),
(
3,
'University of Nowhere',
null,
null,
ARRAY ['nothing',null]
);