149 lines
6.1 KiB
JSON
149 lines
6.1 KiB
JSON
[
|
|
{
|
|
"description": "Basic Merger Execution",
|
|
"database": {
|
|
"puncs": [],
|
|
"enums": [],
|
|
"relations": [],
|
|
"types": [
|
|
{
|
|
"name": "entity",
|
|
"schemas": [
|
|
{
|
|
"$id": "entity",
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"type": {
|
|
"type": "string"
|
|
},
|
|
"archived": {
|
|
"type": "boolean"
|
|
},
|
|
"created_by": {
|
|
"type": "string"
|
|
},
|
|
"modified_by": {
|
|
"type": "string"
|
|
},
|
|
"created_at": {
|
|
"type": "string",
|
|
"format": "date-time"
|
|
},
|
|
"modified_at": {
|
|
"type": "string",
|
|
"format": "date-time"
|
|
}
|
|
},
|
|
"required": [
|
|
"id",
|
|
"type",
|
|
"created_by",
|
|
"created_at",
|
|
"modified_by",
|
|
"modified_at"
|
|
]
|
|
}
|
|
],
|
|
"hierarchy": [
|
|
"entity"
|
|
],
|
|
"fields": [
|
|
"id",
|
|
"type",
|
|
"created_at",
|
|
"created_by",
|
|
"modified_at",
|
|
"modified_by",
|
|
"archived"
|
|
],
|
|
"grouped_fields": {
|
|
"entity": [
|
|
"id",
|
|
"type",
|
|
"created_at",
|
|
"created_by",
|
|
"modified_at",
|
|
"modified_by",
|
|
"archived"
|
|
]
|
|
},
|
|
"lookup_fields": [],
|
|
"historical": false,
|
|
"relationship": false
|
|
},
|
|
{
|
|
"name": "simple_entity",
|
|
"schemas": [
|
|
{
|
|
"$id": "simple_entity",
|
|
"$ref": "entity",
|
|
"properties": {
|
|
"name": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"name"
|
|
]
|
|
}
|
|
],
|
|
"hierarchy": [
|
|
"simple_entity",
|
|
"entity"
|
|
],
|
|
"fields": [
|
|
"id",
|
|
"type",
|
|
"name",
|
|
"created_at",
|
|
"created_by",
|
|
"modified_at",
|
|
"modified_by"
|
|
],
|
|
"grouped_fields": {
|
|
"simple_entity": [
|
|
"id",
|
|
"type",
|
|
"name"
|
|
],
|
|
"entity": [
|
|
"id",
|
|
"type",
|
|
"created_at",
|
|
"created_by",
|
|
"modified_at",
|
|
"modified_by"
|
|
]
|
|
},
|
|
"lookup_fields": [],
|
|
"historical": false,
|
|
"relationship": false
|
|
}
|
|
]
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "Should execute a standard UPSERT via the mock database",
|
|
"action": "merge",
|
|
"data": {
|
|
"id": "123",
|
|
"type": "simple_entity",
|
|
"name": "Jane"
|
|
},
|
|
"expect": {
|
|
"success": true,
|
|
"sql": [
|
|
"SELECT to_jsonb(t1.*) || to_jsonb(t2.*) FROM agreego.\"simple_entity\" t1 LEFT JOIN agreego.\"entity\" t2 ON t2.id = t1.id WHERE t1.id = '123'",
|
|
"INSERT INTO agreego.\"simple_entity\" (\"id\", \"name\", \"type\") VALUES ('123', 'Jane', 'simple_entity')",
|
|
"INSERT INTO agreego.\"entity\" (\"created_at\", \"created_by\", \"id\", \"modified_at\", \"modified_by\", \"type\") VALUES ('{{timestamp}}', '00000000-0000-0000-0000-000000000000', '123', '{{timestamp}}', '00000000-0000-0000-0000-000000000000', 'simple_entity')",
|
|
"INSERT INTO agreego.change (changes, entity_id, id, kind, modified_at, modified_by) VALUES ('{\"name\":\"Jane\",\"type\":\"simple_entity\"}', '123', '{{uuid}}', 'create', '{{timestamp}}', '00000000-0000-0000-0000-000000000000')",
|
|
"SELECT pg_notify('entity', '{\"complete\":{\"created_at\":\"{{timestamp}}\",\"created_by\":\"00000000-0000-0000-0000-000000000000\",\"id\":\"123\",\"modified_at\":\"{{timestamp}}\",\"modified_by\":\"00000000-0000-0000-0000-000000000000\",\"name\":\"Jane\",\"type\":\"simple_entity\"}}')"
|
|
]
|
|
}
|
|
}
|
|
]
|
|
}
|
|
] |