2019-11-06 05:11:03 +03:00
|
|
|
type: bulk
|
|
|
|
args:
|
|
|
|
|
|
|
|
- type: run_sql
|
|
|
|
args:
|
|
|
|
sql: |
|
|
|
|
CREATE TABLE test1 (id serial primary key);
|
|
|
|
CREATE TABLE test2 (id serial primary key);
|
|
|
|
|
|
|
|
CREATE FUNCTION get_test1(int)
|
|
|
|
RETURNS SETOF test1 as $$
|
|
|
|
SELECT * FROM test1 WHERE id = $1
|
|
|
|
$$ LANGUAGE SQL STABLE;
|
|
|
|
|
|
|
|
CREATE FUNCTION get_test2(int)
|
|
|
|
RETURNS SETOF test2 as $$
|
|
|
|
SELECT * FROM test2 WHERE id = $1
|
|
|
|
$$ LANGUAGE SQL STABLE;
|
2019-12-14 09:47:38 +03:00
|
|
|
|
|
|
|
- type: track_table
|
|
|
|
args: test1
|
|
|
|
- type: track_table
|
|
|
|
version: 2
|
|
|
|
args:
|
|
|
|
table: test2
|
|
|
|
configuration:
|
|
|
|
custom_root_fields:
|
|
|
|
select: test2_select
|
|
|
|
insert: test2_insert
|
|
|
|
custom_column_names:
|
|
|
|
id: test2_id
|
|
|
|
|
|
|
|
- type: create_object_relationship
|
|
|
|
args:
|
|
|
|
table: test1
|
|
|
|
name: test2_obj1
|
|
|
|
using:
|
|
|
|
manual_configuration:
|
|
|
|
remote_table: test2
|
|
|
|
column_mapping:
|
|
|
|
id: id
|
|
|
|
- type: create_object_relationship
|
|
|
|
args:
|
|
|
|
table: test1
|
|
|
|
name: test2_obj2
|
|
|
|
using:
|
|
|
|
manual_configuration:
|
|
|
|
remote_table: test2
|
|
|
|
column_mapping:
|
|
|
|
id: id
|
|
|
|
|
|
|
|
- type: create_array_relationship
|
|
|
|
args:
|
|
|
|
table: test2
|
|
|
|
name: test1_arr1
|
|
|
|
using:
|
|
|
|
manual_configuration:
|
|
|
|
remote_table: test2
|
|
|
|
column_mapping:
|
|
|
|
id: id
|
|
|
|
- type: create_array_relationship
|
|
|
|
args:
|
|
|
|
table: test2
|
|
|
|
name: test1_arr2
|
|
|
|
using:
|
|
|
|
manual_configuration:
|
|
|
|
remote_table: test2
|
|
|
|
column_mapping:
|
|
|
|
id: id
|
|
|
|
|
|
|
|
- type: create_select_permission
|
|
|
|
args:
|
|
|
|
table: test1
|
|
|
|
role: role1
|
|
|
|
permission:
|
|
|
|
columns: '*'
|
|
|
|
filter: {}
|
|
|
|
- type: create_select_permission
|
|
|
|
args:
|
|
|
|
table: test1
|
|
|
|
role: role2
|
|
|
|
permission:
|
|
|
|
columns: '*'
|
|
|
|
filter: {}
|
|
|
|
|
|
|
|
- type: create_insert_permission
|
|
|
|
args:
|
|
|
|
table: test1
|
|
|
|
role: role1
|
|
|
|
permission:
|
|
|
|
check: {}
|
|
|
|
- type: create_insert_permission
|
|
|
|
args:
|
|
|
|
table: test1
|
|
|
|
role: role2
|
|
|
|
permission:
|
|
|
|
check: {}
|
|
|
|
|
|
|
|
- type: create_update_permission
|
|
|
|
args:
|
|
|
|
table: test1
|
|
|
|
role: role1
|
|
|
|
permission:
|
|
|
|
columns: '*'
|
|
|
|
filter: {}
|
|
|
|
- type: create_update_permission
|
|
|
|
args:
|
|
|
|
table: test1
|
|
|
|
role: role2
|
|
|
|
permission:
|
|
|
|
columns: '*'
|
|
|
|
filter: {}
|
|
|
|
|
|
|
|
- type: create_delete_permission
|
|
|
|
args:
|
|
|
|
table: test1
|
|
|
|
role: role1
|
|
|
|
permission:
|
|
|
|
filter: {}
|
|
|
|
- type: create_delete_permission
|
|
|
|
args:
|
|
|
|
table: test1
|
|
|
|
role: role2
|
|
|
|
permission:
|
|
|
|
filter: {}
|
|
|
|
|
|
|
|
- type: create_event_trigger
|
|
|
|
args:
|
|
|
|
table: test1
|
|
|
|
name: event_trigger_1
|
|
|
|
insert:
|
|
|
|
columns: '*'
|
|
|
|
update:
|
|
|
|
columns: '*'
|
|
|
|
webhook: http://httpbin.org/post
|
|
|
|
- type: create_event_trigger
|
|
|
|
args:
|
|
|
|
table: test1
|
|
|
|
name: event_trigger_2
|
|
|
|
insert:
|
|
|
|
columns: '*'
|
|
|
|
update:
|
|
|
|
columns: '*'
|
|
|
|
webhook: http://httpbin.org/post
|
|
|
|
|
|
|
|
- type: track_function
|
|
|
|
args: get_test1
|
|
|
|
- type: track_function
|
|
|
|
args: get_test2
|
|
|
|
|
|
|
|
- type: create_query_collection
|
|
|
|
args:
|
|
|
|
name: collection_1
|
|
|
|
definition:
|
|
|
|
queries:
|
|
|
|
- name: query_1
|
|
|
|
query: |
|
|
|
|
query {
|
|
|
|
test1{
|
|
|
|
id
|
|
|
|
}
|
|
|
|
}
|
|
|
|
- name: query_2
|
|
|
|
query: |
|
|
|
|
query {
|
2022-03-08 12:48:21 +03:00
|
|
|
test2_select{
|
|
|
|
test2_id
|
2019-12-14 09:47:38 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- type: create_query_collection
|
|
|
|
args:
|
|
|
|
name: collection_2
|
|
|
|
definition:
|
|
|
|
queries:
|
|
|
|
- name: query_1
|
|
|
|
query: |
|
|
|
|
query {
|
|
|
|
get_test1(args: {id: 1}){
|
|
|
|
id
|
|
|
|
}
|
|
|
|
}
|
|
|
|
- name: query_2
|
|
|
|
query: |
|
|
|
|
query {
|
|
|
|
get_test2(args: {id: 1}){
|
2022-03-08 12:48:21 +03:00
|
|
|
test2_id
|
2019-12-14 09:47:38 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- type: add_collection_to_allowlist
|
|
|
|
args:
|
|
|
|
collection: collection_1
|
2020-10-29 15:48:45 +03:00
|
|
|
|
2019-12-14 09:47:38 +03:00
|
|
|
- type: add_collection_to_allowlist
|
|
|
|
args:
|
|
|
|
collection: collection_2
|