Test the schema generated in the database. The tests create the database in memory according the configuration given, then display the schema for a specfic table. (The schema is extracted from the table, and requires the table to be succesfully created). Test a single content with no field: $ tests --schema "entity" < { > "content": [ > { > "id": "entity", > } > ] > } > EOF CREATE TABLE "entity" ( "id" INTEGER PRIMARY KEY ) Text fields or numeric fields are created as columns directly in the table: $ tests --schema "entity" < { > "content": [ > { > "id": "entity", > "section": [ > { > "field": [ > { > "name": "name", > "label": {}, > "type": "text", > "required": true > }, > { > "name": "year", > "label": {}, > "type": "integer" > } > ] > } > ] > } > ] > } > EOF CREATE TABLE "entity" ( "id" INTEGER PRIMARY KEY , "year" INTEGER , "name" VARCHAR ) A subcontent is linked to the parent: $ tests --schema "details" < { > "content": [ > { > "id": "entity", > "subcontent": [ > { > "id": "details" > } > ] > } > ] > } > EOF CREATE TABLE "details" ( "parent" INTEGER NOT NULL , "id" INTEGER PRIMARY KEY , FOREIGN KEY("parent") REFERENCES "entity"("id") ) A reference field is declared as a foreign key to the linked element $ tests --schema "entity" < { > "content": [ > { > "id": "entity", > "section": [ > { > "field": [ > { > "name": "name", > "label": {}, > "type": "text", > "required": true > }, > { > "name": "user_type", > "label": {}, > "type": { > "content": "user_type_list", > "multivaluated": false > } > } > ] > } > ] > }, > { > "id": "user_type_list" > } > ] > } > EOF CREATE TABLE "entity" ( "id" INTEGER PRIMARY KEY , "user_type" INTEGER , "name" VARCHAR , FOREIGN KEY("user_type") REFERENCES "user_type_list"("id") ) When the field is multivaluated, there is no column for this property in the table but a dedicated table is created: $ tests --schema "entity" "entity.user_type" < { > "content": [ > { > "id": "entity", > "section": [ > { > "field": [ > { > "name": "user_type", > "label": {}, > "type": { > "content": "user_type_list", > "multivaluated": true > } > } > ] > } > ] > }, > { > "id": "user_type_list" > } > ] > } > EOF CREATE TABLE "entity" ( "id" INTEGER PRIMARY KEY ) CREATE TABLE "entity.user_type" ( "id" INTEGER PRIMARY KEY , "parent" INTEGER NOT NULL , "target" INTEGER NOT NULL , FOREIGN KEY("parent") REFERENCES "entity"("id") , FOREIGN KEY("target") REFERENCES "user_type_list"("id") ) A declared list gets its own table, holding an id. A reference field pointing to a list is an integer column constrained by a foreign key to the list table: $ tests --schema "user_type_list" "entity" < { > "list": [ > { > "id": "user_type_list", > "source": "csv" > } > ], > "content": [ > { > "id": "entity", > "section": [ > { > "field": [ > { > "name": "user_type", > "label": {}, > "type": { "content": "user_type_list" } > } > ] > } > ] > } > ] > } > EOF CREATE TABLE "user_type_list" ( "id" INTEGER PRIMARY KEY ) CREATE TABLE "entity" ( "id" INTEGER PRIMARY KEY , "user_type" INTEGER , FOREIGN KEY("user_type") REFERENCES "user_type_list"("id") ) A multivaluated reference to a list gets the usual dedicated table, with the target column referencing the list table: $ tests --schema "entity.user_type" < { > "list": [ > { > "id": "user_type_list", > "source": "csv" > } > ], > "content": [ > { > "id": "entity", > "section": [ > { > "field": [ > { > "name": "user_type", > "label": {}, > "type": { > "content": "user_type_list", > "multivaluated": true > } > } > ] > } > ] > } > ] > } > EOF CREATE TABLE "entity.user_type" ( "id" INTEGER PRIMARY KEY , "parent" INTEGER NOT NULL , "target" INTEGER NOT NULL , FOREIGN KEY("parent") REFERENCES "entity"("id") , FOREIGN KEY("target") REFERENCES "user_type_list"("id") )