From 8708171877054c98aad45079d85d4e699420f2fe Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Thu, 19 Nov 2026 11:32:16 +0100 Subject: Added fields in lists --- lib/query/tests/create.t | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) (limited to 'lib/query/tests/create.t') diff --git a/lib/query/tests/create.t b/lib/query/tests/create.t index 46e3940..7f41ad0 100644 --- a/lib/query/tests/create.t +++ b/lib/query/tests/create.t @@ -156,8 +156,7 @@ to a list is an integer column constrained by a foreign key to the list table: > { > "list": [ > { - > "id": "user_type_list", - > "source": "csv" + > "id": "user_type_list" > } > ], > "content": [ @@ -192,8 +191,7 @@ target column referencing the list table: > { > "list": [ > { - > "id": "user_type_list", - > "source": "csv" + > "id": "user_type_list" > } > ], > "content": [ @@ -223,3 +221,37 @@ target column referencing the list table: , "target" INTEGER NOT NULL , FOREIGN KEY("parent") REFERENCES "entity"("id") , FOREIGN KEY("target") REFERENCES "user_type_list"("id") ) + +A list with fields gets one column per field. A reference field in the list is +a foreign key to the targeted list table: + + $ tests --schema "country_list" "user_type_list" < { + > "list": [ + > { + > "id": "country_list", + > "field": [ + > { "name": "name", "label": {}, "type": "text" } + > ] + > }, + > { + > "id": "user_type_list", + > "field": [ + > { + > "name": "country", + > "label": {}, + > "type": { "content": "country_list" } + > } + > ] + > } + > ], + > "content": [ { "id": "entity" } ] + > } + > EOF + CREATE TABLE "country_list" + ( "id" INTEGER PRIMARY KEY + , "name" VARCHAR ) + CREATE TABLE "user_type_list" + ( "id" INTEGER PRIMARY KEY + , "country" INTEGER + , FOREIGN KEY("country") REFERENCES "country_list"("id") ) -- cgit v1.2.3