final queryer and merger test suite installed; docs fully up to date
This commit is contained in:
@ -36,6 +36,34 @@
|
||||
"type"
|
||||
],
|
||||
"prefix": "target"
|
||||
},
|
||||
{
|
||||
"id": "22222222-2222-2222-2222-222222222222",
|
||||
"type": "relation",
|
||||
"constraint": "fk_order_customer",
|
||||
"source_type": "order",
|
||||
"source_columns": [
|
||||
"customer_id"
|
||||
],
|
||||
"destination_type": "person",
|
||||
"destination_columns": [
|
||||
"id"
|
||||
],
|
||||
"prefix": "customer"
|
||||
},
|
||||
{
|
||||
"id": "33333333-3333-3333-3333-333333333333",
|
||||
"type": "relation",
|
||||
"constraint": "fk_order_line_order",
|
||||
"source_type": "order_line",
|
||||
"source_columns": [
|
||||
"order_id"
|
||||
],
|
||||
"destination_type": "order",
|
||||
"destination_columns": [
|
||||
"id"
|
||||
],
|
||||
"prefix": "lines"
|
||||
}
|
||||
],
|
||||
"types": [
|
||||
@ -462,6 +490,155 @@
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "order",
|
||||
"schemas": [
|
||||
{
|
||||
"$id": "order",
|
||||
"$ref": "entity",
|
||||
"properties": {
|
||||
"total": {
|
||||
"type": "number"
|
||||
},
|
||||
"customer_id": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"$id": "full.order",
|
||||
"$ref": "order",
|
||||
"properties": {
|
||||
"customer": {
|
||||
"$ref": "base.person"
|
||||
},
|
||||
"lines": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "order_line"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"hierarchy": [
|
||||
"order",
|
||||
"entity"
|
||||
],
|
||||
"fields": [
|
||||
"id",
|
||||
"type",
|
||||
"total",
|
||||
"customer_id",
|
||||
"created_at",
|
||||
"created_by",
|
||||
"modified_at",
|
||||
"modified_by",
|
||||
"archived"
|
||||
],
|
||||
"grouped_fields": {
|
||||
"order": [
|
||||
"id",
|
||||
"type",
|
||||
"total",
|
||||
"customer_id"
|
||||
],
|
||||
"entity": [
|
||||
"id",
|
||||
"type",
|
||||
"created_at",
|
||||
"created_by",
|
||||
"modified_at",
|
||||
"modified_by",
|
||||
"archived"
|
||||
]
|
||||
},
|
||||
"lookup_fields": [
|
||||
"id"
|
||||
],
|
||||
"historical": true,
|
||||
"relationship": false,
|
||||
"field_types": {
|
||||
"id": "uuid",
|
||||
"type": "text",
|
||||
"archived": "boolean",
|
||||
"total": "numeric",
|
||||
"customer_id": "uuid",
|
||||
"created_at": "timestamptz",
|
||||
"created_by": "uuid",
|
||||
"modified_at": "timestamptz",
|
||||
"modified_by": "uuid"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "order_line",
|
||||
"schemas": [
|
||||
{
|
||||
"$id": "order_line",
|
||||
"$ref": "entity",
|
||||
"properties": {
|
||||
"order_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"product": {
|
||||
"type": "string"
|
||||
},
|
||||
"price": {
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"hierarchy": [
|
||||
"order_line",
|
||||
"entity"
|
||||
],
|
||||
"fields": [
|
||||
"id",
|
||||
"type",
|
||||
"order_id",
|
||||
"product",
|
||||
"price",
|
||||
"created_at",
|
||||
"created_by",
|
||||
"modified_at",
|
||||
"modified_by",
|
||||
"archived"
|
||||
],
|
||||
"grouped_fields": {
|
||||
"order_line": [
|
||||
"id",
|
||||
"type",
|
||||
"order_id",
|
||||
"product",
|
||||
"price"
|
||||
],
|
||||
"entity": [
|
||||
"id",
|
||||
"type",
|
||||
"created_at",
|
||||
"created_by",
|
||||
"modified_at",
|
||||
"modified_by",
|
||||
"archived"
|
||||
]
|
||||
},
|
||||
"lookup_fields": [],
|
||||
"historical": true,
|
||||
"relationship": false,
|
||||
"field_types": {
|
||||
"id": "uuid",
|
||||
"type": "text",
|
||||
"archived": "boolean",
|
||||
"order_id": "uuid",
|
||||
"product": "text",
|
||||
"price": "numeric",
|
||||
"created_at": "timestamptz",
|
||||
"created_by": "uuid",
|
||||
"modified_at": "timestamptz",
|
||||
"modified_by": "uuid"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -480,8 +657,8 @@
|
||||
" 'id', t1_obj_t1.id,",
|
||||
" 'name', t1_obj_t1.name,",
|
||||
" 'type', t1_obj_t1.type)",
|
||||
" FROM agreego.entity t1_obj_t1",
|
||||
" WHERE NOT t1_obj_t1.archived)"
|
||||
"FROM agreego.entity t1_obj_t1",
|
||||
"WHERE NOT t1_obj_t1.archived)"
|
||||
]
|
||||
]
|
||||
}
|
||||
@ -501,8 +678,8 @@
|
||||
" 'id', t1_obj_t1.id,",
|
||||
" 'name', t1_obj_t1.name,",
|
||||
" 'type', t1_obj_t1.type)",
|
||||
" FROM agreego.entity t1_obj_t1",
|
||||
" WHERE NOT t1_obj_t1.archived)"
|
||||
"FROM agreego.entity t1_obj_t1",
|
||||
"WHERE NOT t1_obj_t1.archived)"
|
||||
]
|
||||
]
|
||||
}
|
||||
@ -607,9 +784,9 @@
|
||||
" 'last_name', t1_obj_t1.last_name,",
|
||||
" 'name', t1_obj_t2.name,",
|
||||
" 'type', t1_obj_t2.type)",
|
||||
" FROM agreego.person t1_obj_t1",
|
||||
" JOIN agreego.entity t1_obj_t2 ON t1_obj_t2.id = t1_obj_t1.id",
|
||||
" WHERE NOT t1_obj_t1.archived)"
|
||||
"FROM agreego.person t1_obj_t1",
|
||||
"JOIN agreego.entity t1_obj_t2 ON t1_obj_t2.id = t1_obj_t1.id",
|
||||
"WHERE NOT t1_obj_t1.archived)"
|
||||
]
|
||||
]
|
||||
}
|
||||
@ -1036,6 +1213,62 @@
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "Order select with customer and lines",
|
||||
"action": "query",
|
||||
"schema_id": "full.order",
|
||||
"expect": {
|
||||
"success": true,
|
||||
"sql": [
|
||||
[
|
||||
"(SELECT jsonb_build_object(",
|
||||
" 'archived', t1_obj_t2.archived,",
|
||||
" 'created_at', t1_obj_t2.created_at,",
|
||||
" 'customer',",
|
||||
" (SELECT jsonb_build_object(",
|
||||
" 'age', t1_obj_t2_customer_t1.age,",
|
||||
" 'archived', t1_obj_t2_customer_t2.archived,",
|
||||
" 'created_at', t1_obj_t2_customer_t2.created_at,",
|
||||
" 'first_name', t1_obj_t2_customer_t1.first_name,",
|
||||
" 'id', t1_obj_t2_customer_t2.id,",
|
||||
" 'last_name', t1_obj_t2_customer_t1.last_name,",
|
||||
" 'name', t1_obj_t2_customer_t2.name,",
|
||||
" 'type', t1_obj_t2_customer_t2.type",
|
||||
" )",
|
||||
" FROM agreego.person t1_obj_t2_customer_t1",
|
||||
" JOIN agreego.entity t1_obj_t2_customer_t2 ON t1_obj_t2_customer_t2.id = t1_obj_t2_customer_t1.id",
|
||||
" WHERE",
|
||||
" NOT t1_obj_t2_customer_t1.archived",
|
||||
" AND t1_obj_t2_customer_t1.parent_id = t1_obj_t2.id),",
|
||||
" 'customer_id', t1_obj_t1.customer_id,",
|
||||
" 'id', t1_obj_t2.id,",
|
||||
" 'lines',",
|
||||
" (SELECT COALESCE(jsonb_agg(jsonb_build_object(",
|
||||
" 'archived', t1_obj_t2_lines_t2.archived,",
|
||||
" 'created_at', t1_obj_t2_lines_t2.created_at,",
|
||||
" 'id', t1_obj_t2_lines_t2.id,",
|
||||
" 'name', t1_obj_t2_lines_t2.name,",
|
||||
" 'order_id', t1_obj_t2_lines_t1.order_id,",
|
||||
" 'price', t1_obj_t2_lines_t1.price,",
|
||||
" 'product', t1_obj_t2_lines_t1.product,",
|
||||
" 'type', t1_obj_t2_lines_t2.type",
|
||||
" )), '[]'::jsonb)",
|
||||
" FROM agreego.order_line t1_obj_t2_lines_t1",
|
||||
" JOIN agreego.entity t1_obj_t2_lines_t2 ON t1_obj_t2_lines_t2.id = t1_obj_t2_lines_t1.id",
|
||||
" WHERE",
|
||||
" NOT t1_obj_t2_lines_t1.archived",
|
||||
" AND t1_obj_t2_lines_t1.parent_id = t1_obj_t2.id),",
|
||||
" 'name', t1_obj_t2.name,",
|
||||
" 'total', t1_obj_t1.total,",
|
||||
" 'type', t1_obj_t2.type",
|
||||
")",
|
||||
"FROM agreego.order t1_obj_t1",
|
||||
"JOIN agreego.entity t1_obj_t2 ON t1_obj_t2.id = t1_obj_t1.id",
|
||||
"WHERE NOT t1_obj_t1.archived)"
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user