BohdanLiuisk / DiFY

MIT License
1 stars 0 forks source link

DiFY

Just pet project.

Stack:

Existing functionality:

Dify Entity

Overview of creating tables

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.

JSON structure example

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...
  ]
}

Properties description

Table properties

Column properties

Data types

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.

Best practices

Dify Entity Query

to be described...