mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-20 05:51:54 +03:00
b856d96989
Making it easier to inject different ones later. I also included a change to _.prettierignore_ so Visual Studio Code doesn't keep trying to reformat the JavaScript or YAML files in `server/tests-py`, as it can cause diffs to balloon for no obvious benefit. PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5456 GitOrigin-RevId: bc6d548708160a328e1e61a00e19be8e124da025
121 lines
2.7 KiB
YAML
121 lines
2.7 KiB
YAML
type: bulk
|
|
args:
|
|
|
|
# To model this:
|
|
|
|
# query {
|
|
# profiles {
|
|
# id
|
|
# message {
|
|
# id
|
|
# msg
|
|
# }
|
|
# }
|
|
# }
|
|
|
|
#Profile table
|
|
|
|
- type: run_sql
|
|
args:
|
|
sql: |
|
|
create schema custom;
|
|
create table custom.profiles (
|
|
id serial primary key,
|
|
name text
|
|
);
|
|
insert into custom.profiles (name) values
|
|
( 'alice' ),
|
|
( 'bob' ),
|
|
( 'alice');
|
|
|
|
create table authors (
|
|
id serial primary key,
|
|
name text
|
|
);
|
|
create table employees (
|
|
id serial primary key,
|
|
name text
|
|
);
|
|
insert into employees (name) values ('alice'),(NULL),('bob');
|
|
create table students (
|
|
id serial primary key,
|
|
name text not null,
|
|
physics integer,
|
|
maths integer
|
|
);
|
|
insert into students (name, physics, maths) values ('alice', 45, 48), ('bob', 32, 40);
|
|
create function total_marks(student_row students)
|
|
returns integer as $$
|
|
select student_row.physics + student_row.maths
|
|
$$ language sql stable;
|
|
create function total_marks_offset(student_row students, "offset" integer)
|
|
returns integer as $$
|
|
select student_row.physics + student_row.maths - "offset"
|
|
$$ language sql stable;
|
|
create function total_marks_session(student_row students, hasura_session json)
|
|
returns integer as $$
|
|
select student_row.physics + student_row.maths - (hasura_session ->> 'x-hasura-offset')::integer
|
|
$$ language sql stable;
|
|
create table regression_7172 (
|
|
id serial primary key,
|
|
features json
|
|
);
|
|
insert into regression_7172 (features) values ('{"Start Color":44}');
|
|
|
|
- type: track_table
|
|
args:
|
|
schema: custom
|
|
name: profiles
|
|
|
|
- type: add_remote_schema
|
|
args:
|
|
name: my-remote-schema
|
|
definition:
|
|
url: "{{GRAPHQL_SERVICE_HANDLER}}"
|
|
forward_client_headers: false
|
|
|
|
- type: track_table
|
|
args:
|
|
schema: public
|
|
name: authors
|
|
|
|
- type: track_table
|
|
args:
|
|
schema: public
|
|
name: employees
|
|
|
|
- type: track_table
|
|
args:
|
|
schema: public
|
|
name: students
|
|
|
|
- type: add_computed_field
|
|
args:
|
|
table: students
|
|
name: total_marks
|
|
definition:
|
|
function: total_marks
|
|
table_argument: student_row
|
|
|
|
- type: add_computed_field
|
|
args:
|
|
table: students
|
|
name: total_marks_offset
|
|
definition:
|
|
function: total_marks_offset
|
|
table_argument: student_row
|
|
|
|
- type: add_computed_field
|
|
args:
|
|
table: students
|
|
name: total_marks_session
|
|
definition:
|
|
function: total_marks_session
|
|
table_argument: student_row
|
|
session_argument: hasura_session
|
|
|
|
- type: track_table
|
|
args:
|
|
schema: public
|
|
name: regression_7172
|