added defaults support for lookups

This commit is contained in:
2026-08-03 21:22:27 -04:00
parent d43be1def4
commit 53776fc696
5 changed files with 76 additions and 11 deletions

View File

@ -132,6 +132,15 @@
"columns": [
"name"
]
},
{
"table": "relationship",
"columns": [
"type",
"source_id",
"target_id",
"start_date"
]
}
],
"types": [
@ -573,6 +582,8 @@
"source_type",
"target_id",
"target_type",
"start_date",
"end_date",
"id",
"type",
"name",
@ -597,7 +608,9 @@
"source_id",
"source_type",
"target_id",
"target_type"
"target_type",
"start_date",
"end_date"
]
},
"field_types": {
@ -608,6 +621,8 @@
"source_type": "text",
"target_id": "uuid",
"target_type": "text",
"start_date": "timestamptz",
"end_date": "timestamptz",
"name": "text",
"created_at": "timestamptz",
"created_by": "uuid",
@ -620,7 +635,16 @@
"properties": {}
}
},
"lookup_fields": [],
"lookup_fields": [
"type",
"source_id",
"target_id",
"start_date"
],
"field_defaults": {
"start_date": "0001-01-01T00:00:00Z",
"end_date": "9999-12-31T23:59:59Z"
},
"historical": true,
"notify": true
},
@ -2766,6 +2790,17 @@
" '00000000-0000-0000-0000-000000000000'",
")"
],
[
"(SELECT COALESCE(to_jsonb(t1.*), '{}') || COALESCE(to_jsonb(t2.*), '{}') || COALESCE(to_jsonb(t3.*), '{}')",
"FROM agreego.\"entity\" t1",
"LEFT JOIN agreego.\"relationship\" t2 ON t2.id = t1.id",
"LEFT JOIN agreego.\"contact\" t3 ON t3.id = t1.id",
"WHERE",
" (t1.\"type\" = 'contact'",
" AND \"source_id\" = '{{uuid:generated_0}}'",
" AND \"target_id\" = '{{uuid:generated_1}}'",
" AND \"start_date\" = '{{timestamp}}'))"
],
[
"INSERT INTO agreego.\"entity\" (",
" \"created_at\",",
@ -2887,6 +2922,17 @@
" '00000000-0000-0000-0000-000000000000'",
")"
],
[
"(SELECT COALESCE(to_jsonb(t1.*), '{}') || COALESCE(to_jsonb(t2.*), '{}') || COALESCE(to_jsonb(t3.*), '{}')",
"FROM agreego.\"entity\" t1",
"LEFT JOIN agreego.\"relationship\" t2 ON t2.id = t1.id",
"LEFT JOIN agreego.\"contact\" t3 ON t3.id = t1.id",
"WHERE",
" (t1.\"type\" = 'contact'",
" AND \"source_id\" = '{{uuid:generated_0}}'",
" AND \"target_id\" = '{{uuid:generated_5}}'",
" AND \"start_date\" = '{{timestamp}}'))"
],
[
"INSERT INTO agreego.\"entity\" (",
" \"created_at\",",
@ -3008,6 +3054,17 @@
" '00000000-0000-0000-0000-000000000000'",
")"
],
[
"(SELECT COALESCE(to_jsonb(t1.*), '{}') || COALESCE(to_jsonb(t2.*), '{}') || COALESCE(to_jsonb(t3.*), '{}')",
"FROM agreego.\"entity\" t1",
"LEFT JOIN agreego.\"relationship\" t2 ON t2.id = t1.id",
"LEFT JOIN agreego.\"contact\" t3 ON t3.id = t1.id",
"WHERE",
" (t1.\"type\" = 'contact'",
" AND \"source_id\" = '{{uuid:generated_0}}'",
" AND \"target_id\" = '{{uuid:generated_9}}'",
" AND \"start_date\" = '{{timestamp}}'))"
],
[
"INSERT INTO agreego.\"entity\" (",
" \"created_at\",",