diff options
| author | Sébastien Dailly <sebastien@dailly.me> | 2026-11-19 11:32:16 +0100 |
|---|---|---|
| committer | Sébastien Dailly <sebastien@dailly.me> | 2026-11-19 11:32:16 +0100 |
| commit | 8708171877054c98aad45079d85d4e699420f2fe (patch) | |
| tree | 2e580e6891708b7b70d07f7bec03bd0a76ae171b /lib/query/tests | |
| parent | e1bf7686f408b52a870d4ed4f3c565dbbcc3954f (diff) | |
Added fields in lists
Diffstat (limited to 'lib/query/tests')
| -rw-r--r-- | lib/query/tests/create.t | 40 |
1 files changed, 36 insertions, 4 deletions
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" <<EOF + > { + > "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") ) |
