logologo
Get Started
Guide
Development
Plugins
API
English
简体中文
Get Started
Guide
Development
Plugins
API
English
简体中文
logologo
Overview

Data sources

Data source manager
Main data source

External data sources (Databases)

Overview
External MySQL
External MariaDB
External PostgreSQL
External MSSQL
External Oracle
Main vs External Databases
REST API data source
KingbaseES data source

Collections

Overview
General collection
Inheritance collection
File collection
Tree collection
Calendar collection
Comment collection
Expression collection
SQL collection
View collection

Collection fields

Overview
Field Validation

Basic

Single text
Long text
Phone
Email
URL
Integer
Number
Percent
Password
Color
Icon

Choices

Checkbox
Select
Multiple select
Radio group
Checkbox group

Media

Markdown
Markdown (Vditor)
Rich text
Attachment (Relationship)
Attachment (URL)

Date & Time

Overview
Date & time (with timezone)
Date & time (without timezone)
Unix timestamp
Date (without time)
Time

Geometry

Point
Line
Circle
Polygon

Advanced

Snowflake ID (53-bit)
UUID
Nano ID
Sort
Formula
Sequence
JSON
Collection select
Encryption

System info

Created at
Updated at
Created by
Last updated by
Space
Table OID

Associations

Overview
One to one
One to many
Many to one
Many to many
Many to many (array)

Development

Overview
Next PageOverview

#One-to-One

In the relationship between employees and personal profiles, each employee can only have one personal profile record, and each personal profile record can only correspond to one employee. In this case, the relationship between the employee and the personal profile is one-to-one.

The foreign key in a one-to-one relationship can be placed in either the source collection or the target collection. If it represents "has one," the foreign key is more appropriately placed in the target collection; if it represents "belongs to," then the foreign key is better placed in the source collection.

For example, in the case mentioned above, where an employee has only one personal profile and the personal profile belongs to the employee, it is appropriate to place the foreign key in the personal profile collection.

#One-to-One (Has One)

This indicates that an employee has a personal profile record.

ER Relationship

alt text

Field Configuration

alt text

#One-to-One (Belongs To)

This indicates that a personal profile belongs to a specific employee.

ER Relationship

Field Configuration

alt text

#Parameter Descriptions

#Source Collection

The source collection, which is the collection where the current field is located.

#Target Collection

The target collection, the collection that is being related.

#Foreign Key

Used to establish a relationship between two collections. In a one-to-one relationship, the foreign key can be placed in either the source collection or the target collection. If it represents "has one," the foreign key is more appropriately placed in the target collection; if it represents "belongs to," then the foreign key is better placed in the source collection.

#Source Key <- Foreign Key (Foreign Key in the Target collection)

The field referenced by the foreign key constraint must be unique. When the foreign key is placed in the target collection, it indicates "has one."

#Target Key <- Foreign Key (Foreign Key in the Source collection)

The field referenced by the foreign key constraint must be unique. When the foreign key is placed in the source collection, it indicates "belongs to."

#ON DELETE

ON DELETE refers to the action rules for the foreign key reference in the related child collection when deleting records from the parent collection. It is an option defined when establishing a foreign key constraint. Common ON DELETE options include:

  • CASCADE: When a record in the parent collection is deleted, automatically delete all related records in the child collection.
  • SET NULL: When a record in the parent collection is deleted, set the foreign key value in the related child collection to NULL.
  • RESTRICT: The default option, where deletion of a parent collection record is refused if there are related records in the child collection.
  • NO ACTION: Similar to RESTRICT, deletion of a parent collection record is refused if there are related records in the child collection.