Just pet project.
This documentation describes the configuration for creating tables in a database, using a JSON-based schema. Below is a detailed explanation of the properties required to define tables and columns, along with examples.
The following JSON is an example of how to define a table and its columns:
{
"id": "65a93638-295f-4e3a-81e2-4bb13f27edc7",
"name": "contact",
"caption": "Contact",
"columns": [
{
"id": "835540ca-e156-4aab-9136-40e215360b9b",
"name": "id",
"caption": "Id",
"type": 11,
"isPrimaryKey": true
},
{
"id": "ec787866-d762-4622-8e80-00009fabdbca",
"name": "name",
"caption": "Name",
"type": 16,
"size": 250,
"isNullable": false
},
// Other columns...
]
}
false
).true
).The following table describes the available data types for columns:
Type Code | Data Type | PostgreSQL Value | Additional properties | Behavior description |
---|---|---|---|---|
8 | Double | double precision (float8) |
none | Type can be changed to other numeric types. |
15 | Single | real (float4) |
none | Type can be changed to other numeric types. |
10 | Int16 | smallint |
none | Type can be changed to other numeric types. |
11 | Int32 | integer |
none | Type can be changed to other numeric types. |
12 | Int64 | bigint |
none | Type can be changed to other numeric types. |
7 | Decimal | decimal |
size (max: 1000, default: 19), precision (default: 5, should be less than size ) |
Type can be changed to other numeric types, size can be modified but only to greater value, precision can be modified to any other value. |
4 | Currency | money |
none | Type can be changed to other numeric types. |
3 | Boolean | boolean |
none | Type cannot be changed. |
16 | String | text or varchar(size) |
size - varchar($size) |
size can be modified but only to greater value and if it was present before (if it wasn’t text ) |
6 | DateTime | timestamp |
none | Type cannot be changed. |
27 | DateTimeOffset | timestamptz |
none | Type cannot be changed. |
5 | Date | date |
none | Type cannot be changed. |
17 | Time | time |
none | Type cannot be changed. |
1 | Binary | bytea |
none | Type cannot be changed. |
referenceEntityId
to establish relationships between tables.isNullable
is set appropriately, depending on the data requirements.to be described...