jsob and test array handling improved in merger

This commit is contained in:
2026-03-20 05:58:43 -04:00
parent 6eb134c0d6
commit e01b778d68
2 changed files with 169 additions and 0 deletions

View File

@ -715,6 +715,74 @@
"historical": true,
"notify": true,
"relationship": false
},
{
"name": "attachment",
"schemas": [
{
"$id": "attachment",
"$ref": "entity",
"properties": {
"flags": {
"type": "array",
"items": {
"type": "string"
}
},
"metadata": {
"type": "object",
"additionalProperties": true
}
}
}
],
"hierarchy": [
"attachment",
"entity"
],
"fields": [
"id",
"type",
"flags",
"metadata",
"created_at",
"created_by",
"modified_at",
"modified_by",
"archived"
],
"grouped_fields": {
"attachment": [
"id",
"type",
"flags",
"metadata"
],
"entity": [
"id",
"type",
"created_at",
"created_by",
"modified_at",
"modified_by",
"archived"
]
},
"field_types": {
"id": "uuid",
"type": "text",
"flags": "_text",
"metadata": "jsonb",
"created_at": "timestamptz",
"created_by": "uuid",
"modified_at": "timestamptz",
"modified_by": "uuid",
"archived": "boolean"
},
"lookup_fields": [],
"historical": true,
"notify": true,
"relationship": false
}
]
},
@ -2190,6 +2258,101 @@
]
]
}
},
{
"description": "Insert attachment displaying side-by-side array literal and jsonb formatting translations",
"action": "merge",
"data": {
"type": "attachment",
"flags": [
"urgent",
"reviewed"
],
"metadata": {
"size": 1024,
"source": "upload"
}
},
"expect": {
"success": true,
"sql": [
[
"INSERT INTO agreego.\"entity\" (",
" \"created_at\",",
" \"created_by\",",
" \"id\",",
" \"modified_at\",",
" \"modified_by\",",
" \"type\"",
")",
"VALUES (",
" '{{timestamp}}',",
" '00000000-0000-0000-0000-000000000000',",
" '{{uuid:attachment_id}}',",
" '{{timestamp}}',",
" '00000000-0000-0000-0000-000000000000',",
" 'attachment'",
")"
],
[
"INSERT INTO agreego.\"attachment\" (",
" \"flags\",",
" \"id\",",
" \"metadata\",",
" \"type\"",
")",
"VALUES (",
" '{\"urgent\",\"reviewed\"}',",
" '{{uuid:attachment_id}}',",
" '{\"size\":1024,\"source\":\"upload\"}',",
" 'attachment'",
")"
],
[
"INSERT INTO agreego.change (",
" \"old\",",
" \"new\",",
" entity_id,",
" id,",
" kind,",
" modified_at,",
" modified_by",
")",
"VALUES (",
" NULL,",
" '{",
" \"flags\":[\"urgent\",\"reviewed\"],",
" \"metadata\":{\"size\":1024,\"source\":\"upload\"},",
" \"type\":\"attachment\"",
" }',",
" '{{uuid:attachment_id}}',",
" '{{uuid}}',",
" 'create',",
" '{{timestamp}}',",
" '00000000-0000-0000-0000-000000000000'",
")"
],
[
"SELECT pg_notify('entity', '{",
" \"complete\":{",
" \"created_at\":\"{{timestamp}}\",",
" \"created_by\":\"00000000-0000-0000-0000-000000000000\",",
" \"flags\":[\"urgent\",\"reviewed\"],",
" \"id\":\"{{uuid:attachment_id}}\",",
" \"metadata\":{\"size\":1024,\"source\":\"upload\"},",
" \"modified_at\":\"{{timestamp}}\",",
" \"modified_by\":\"00000000-0000-0000-0000-000000000000\",",
" \"type\":\"attachment\"",
" },",
" \"new\":{",
" \"flags\":[\"urgent\",\"reviewed\"],",
" \"metadata\":{\"size\":1024,\"source\":\"upload\"},",
" \"type\":\"attachment\"",
" }",
" }')"
]
]
}
}
]
}