custom_field_sections
Attributes:
Attribute | Type | Constraints | Description |
---|---|---|---|
id | BIGINT UNSIGNED | Primary Key | Unique identifier for the custom field section. |
tenant_id | BIGINT UNSIGNED | Foreign Key, Nullable, Indexed | References tenants.id if multitenancy is enabled. |
code | VARCHAR(255) | Not Null | Unique code for the custom field section. |
name | VARCHAR(255) | Not Null | Human-readable name of the custom field section. |
type | VARCHAR(255) | Not Null | Type of the section (e.g., 'section' , 'fieldset' , 'headless' ). |
entity_type | VARCHAR(255) | Not Null | The entity (model) type associated with this section (e.g., 'Customer' , 'Order' ). |
sort_order | BIGINT UNSIGNED | Nullable | Order for displaying sections in the user interface. |
description | VARCHAR(255) | Nullable | Optional description providing more details about the section. |
active | BOOLEAN | Default TRUE | Indicates if the section is active and should be displayed. |
system_defined | BOOLEAN | Default FALSE | Indicates if the section is system-defined and may have restrictions on changes. |
created_at | TIMESTAMP | Default CURRENT_TIMESTAMP | Record creation timestamp. |
updated_at | TIMESTAMP | Default CURRENT_TIMESTAMP ON UPDATE | Record update timestamp. |
id
entity_type
, code
, tenant_id
) (if tenant_id
is present)tenant_id
references tenants.id
(if multitenancy is enabled)tenant_id
(for query optimization)custom_fields
Attributes:
Attribute | Type | Constraints | Description |
---|---|---|---|
id | BIGINT UNSIGNED | Primary Key | Unique identifier for the custom field. |
custom_field_section_id | BIGINT UNSIGNED | Foreign Key, Nullable | References custom_field_sections.id . Groups the custom field under a section. |
width | VARCHAR(255) | Nullable | Defines the display width of the field in the UI (e.g., 'full' , 'half' ). |
tenant_id | BIGINT UNSIGNED | Foreign Key, Nullable, Indexed | References tenants.id if multitenancy is enabled. |
code | VARCHAR(255) | Not Null | Unique code for the custom field. |
name | VARCHAR(255) | Not Null | Human-readable name of the custom field. |
type | VARCHAR(255) | Not Null | Data type of the custom field (e.g., 'string' , 'integer' , 'boolean' , 'date' , 'select' ). |
lookup_type | VARCHAR(255) | Nullable | Type for lookup fields or relational associations. |
entity_type | VARCHAR(255) | Not Null | The entity (model) type associated with this custom field (e.g., 'Customer' , 'Order' ). |
sort_order | BIGINT UNSIGNED | Nullable | Order for displaying fields in the user interface. |
validation_rules | JSON | Nullable | JSON-formatted validation rules (e.g., {"required": true, "max": 255} ). |
active | BOOLEAN | Default TRUE | Indicates if the custom field is active and should be displayed. |
system_defined | BOOLEAN | Default FALSE | Indicates if the field is system-defined and may have restrictions on changes. |
created_at | TIMESTAMP | Default CURRENT_TIMESTAMP | Record creation timestamp. |
updated_at | TIMESTAMP | Default CURRENT_TIMESTAMP ON UPDATE | Record update timestamp. |
id
code
, entity_type
, tenant_id
) (if tenant_id
is present)tenant_id
references tenants.id
(if multitenancy is enabled)custom_field_section_id
references custom_field_sections.id
tenant_id
, custom_field_section_id
(for query optimization)custom_field_options
Attributes:
Attribute | Type | Constraints | Description |
---|---|---|---|
id | BIGINT UNSIGNED | Primary Key | Unique identifier for the custom field option. |
tenant_id | BIGINT UNSIGNED | Foreign Key, Nullable, Indexed | References tenants.id if multitenancy is enabled. |
custom_field_id | BIGINT UNSIGNED | Foreign Key | References custom_fields.id . |
name | VARCHAR(255) | Nullable | Option name or value. |
sort_order | BIGINT UNSIGNED | Nullable | Order for displaying options in the user interface. |
created_at | TIMESTAMP | Default CURRENT_TIMESTAMP | Record creation timestamp. |
updated_at | TIMESTAMP | Default CURRENT_TIMESTAMP ON UPDATE | Record update timestamp. |
id
custom_field_id
, name
, tenant_id
) (if tenant_id
is present)tenant_id
references tenants.id
(if multitenancy is enabled)custom_field_id
references custom_fields.id
(with CASCADE ON DELETE
)tenant_id
, custom_field_id
(for query optimization)custom_field_values
Attributes:
Attribute | Type | Constraints | Description |
---|---|---|---|
id | BIGINT UNSIGNED | Primary Key | Unique identifier for the custom field value. |
tenant_id | BIGINT UNSIGNED | Foreign Key, Nullable, Indexed | References tenants.id if multitenancy is enabled. |
entity_type | VARCHAR(255) | Not Null | The entity (model) type associated with this custom field value (e.g., 'Customer' , 'Order' ). |
entity_id | BIGINT UNSIGNED | Not Null | The ID of the entity instance. |
custom_field_id | BIGINT UNSIGNED | Foreign Key | References custom_fields.id . |
string_value | VARCHAR(255) | Nullable | Value when the custom field type is string. |
text_value | TEXT | Nullable | Value when the custom field type is text. |
boolean_value | BOOLEAN | Nullable | Value when the custom field type is boolean. |
integer_value | INTEGER | Nullable | Value when the custom field type is integer. |
float_value | DOUBLE | Nullable | Value when the custom field type is float. |
date_value | DATE | Nullable | Value when the custom field type is date. |
datetime_value | DATETIME | Nullable | Value when the custom field type is datetime. |
json_value | JSON | Nullable | Value when the custom field type is JSON or for storing array of values. |
created_at | TIMESTAMP | Default CURRENT_TIMESTAMP | Record creation timestamp. |
updated_at | TIMESTAMP | Default CURRENT_TIMESTAMP ON UPDATE | Record update timestamp. |
id
entity_type
, entity_id
, custom_field_id
, tenant_id
) (if tenant_id
is present)tenant_id
references tenants.id
(if multitenancy is enabled)custom_field_id
references custom_fields.id
(with CASCADE ON DELETE
)tenant_id
, entity_type
, entity_id
, custom_field_id
(for query optimization)entity_type
and entity_id
to associate with any entity in the application.custom_field_section_id
references custom_field_sections.id
custom_field_id
references custom_fields.id
custom_field_id
references custom_fields.id
entity_type
and entity_id
entity_type
, code
, tenant_id
) (if tenant_id
is present)code
, entity_type
, tenant_id
) (if tenant_id
is present)custom_field_id
, name
, tenant_id
) (if tenant_id
is present)entity_type
, entity_id
, custom_field_id
, tenant_id
) (if tenant_id
is present)tenant_id
tenants.id
in all tables where multitenancy is enabled.custom_field_section_id
custom_field_sections.id
in custom_fields
.custom_field_id
custom_fields.id
in custom_field_options
and custom_field_values
.tenant_id
tenant_id
in each table.tenant_id
to prevent conflicts across tenants.tenant_id
to ensure data isolation.tenant_id
references tenants.id
(assuming a tenants
table exists).tenant_id
column is added only if multitenancy is enabled (Utils::isTenantEnabled()
).tenant_id
optimize tenant-specific queries.code
: 'contact_details'
name
: 'Contact Details'
type
: 'additional'
entity_type
: 'Customer'
sort_order
: 1
description
: 'Additional contact information for the customer.'
'alternate_email'
:
custom_field_section_id
: Reference to 'contact_details'
sectioncode
: 'alternate_email'
name
: 'Alternate Email'
type
: 'string'
entity_type
: 'Customer'
validation_rules
: {"email": true}
'preferred_contact_time'
:
custom_field_section_id
: Reference to 'contact_details'
section
code
: 'preferred_contact_time'
name
: 'Preferred Contact Time'
type
: 'select'
entity_type
: 'Customer'
custom_field_id
: Reference to 'preferred_contact_time'
name
: 'Morning'
sort_order
: 1
custom_field_id
: Reference to 'preferred_contact_time'
name
: 'Afternoon'
sort_order
: 2
custom_field_id
: Reference to 'preferred_contact_time'
name
: 'Evening'
sort_order
: 3
'alternate_email'
:
entity_type
: 'Customer'
entity_id
: 1001
(ID of the customer)custom_field_id
: Reference to 'alternate_email'
string_value
: 'customer.alt@example.com'
'preferred_contact_time'
:
entity_type
: 'Customer'
entity_id
: 1001
custom_field_id
: Reference to 'preferred_contact_time'
string_value
: 'Afternoon'