Ir al contenido

Table: field_definition

Esta página aún no está disponible en tu idioma.

This table references:

Referenced by:

ColumnTypeNullableNotes
iduuidnoDefault gen_random_uuid()
codetextno-
labeltextno-
descriptiontextnoDefault ''::text
typetextno-
optionsjsonbnoDefault '{}'::jsonb
requiredbooleannoDefault false
searchablebooleannoDefault true
applies_tobigint[]noDefault '{}'::bigint[]
read_capabilitytextyes-
write_capabilitytextyes-
display_orderintegernoDefault 100
display_grouptextnoDefault 'general'::text
statustextnoDefault 'active'::text
deprecated_replacement_iduuidyesReferences field_definition(id)
origin_server_iduuidyes-
created_attimestampnoDefault now()
updated_attimestampnoDefault now()
created_by_user_refbigintyes-
updated_by_user_refbigintyes-
subject_kindtextnoDefault 'asset'::text
extraction_sourcetextnoDefault ''::text
extraction_modetextnoDefault 'skip_if_set'::text
default_valuejsonbyesDefault applied when an asset is created: either a literal value or one of a fixed set of values the server resolves from context, never an expression. NULL means no default. Checked on write against the field’s type and, for vocabulary fields, against the current options, so a default naming a deprecated or archived option is refused. In the federation design this travels with the field definition (ADR 0083); field definitions aren’t exchanged between instances yet.
open_vocabularybooleannoDefault false. When true, writing a term the field doesn’t have creates it instead of refusing the write. Applies to multi_select fields only.
mirrors_columntextyesWhen set, the field is a view onto that column of assets instead of storing its own values: reads return the column, and writes update it under that column’s own rules. A mirrored field can’t have rows in asset_field_value or its history (triggers refuse them), so the two can’t disagree. NULL means ordinary field storage. Local to this instance and excluded from the federation design (ADR 0083).
show_on_cardbooleannoDefault false. Display hint: show this field on asset cards. Like display_order and display_group, it affects presentation only; nothing gates access, filtering or correctness on it. Not allowed on a field with a read capability, because cards render on browse pages where per-field read checks aren’t evaluated. In the federation design this travels with the field definition (ADR 0083); field definitions aren’t exchanged between instances yet.
show_in_advanced_searchbooleannoDefault true. Whether the field appears as a filter control on the Advanced search page. The true default keeps installs that never set it looking as before. It controls only the on-page control: it doesn’t change searchable (whether the field’s text is indexed), query results, or a hand-written filter=field:<code>=<value>. The field’s read capability still applies. In the federation design this travels with the field definition (ADR 0083); field definitions aren’t exchanged between instances yet.
show_on_uploadbooleannoDefault true. Whether the field is offered on the upload and create screens. The true default matches earlier behaviour. Not tied to required, because required values are enforced when values are written, not when an asset is created. In the federation design this travels with the field definition (ADR 0083); field definitions aren’t exchanged between instances yet.
edit_tabtextyesWhich tab of the field-editing screens (asset edit, collection edit and create) the field appears on. NULL means no tab; an empty string is refused, so ‘no tab’ has a single representation. A tab holds display_group groups rather than replacing them. In the federation design this travels with the field definition (ADR 0083); field definitions aren’t exchanged between instances yet.
read_onlybooleannoDefault false. Refuses human edits to the field’s values. Enforced when values are set or cleared on assets and collections. It doesn’t freeze the value: upload defaults, metadata extraction and mirror filling can still write, because a read-only field is usually filled in by the system, and those writers have no HTTP route. On an asset the refusal applies from the start; on a collection, the create request may set an initial value and later edits are refused. Not allowed on a mirrored field. An access rule, so local to this instance and excluded from the federation design (ADR 0083).
regexp_filtertextyesPattern that a human-supplied value must match. NULL means no pattern (an empty string is refused; removing a pattern is an explicit clear). The server anchors it to the whole value using Go RE2 syntax, so don’t add ^ or $. Stored exactly as written. Applies to text and longtext fields only, not rich_text, whose stored value is sanitised HTML. It checks human input, not stored rows: defaults, extraction and mirror filling aren’t checked, so a stored value may not match. Not allowed on a mirrored field. In the federation design this travels with the field definition (ADR 0083); field definitions aren’t exchanged between instances yet.
display_conditionjsonbyesWhen the field is offered on a composition screen (ADR 0099). NULL means always; empty values are refused so ‘unset’ has one representation. Otherwise a JSON array of conditions on other fields, all of which must hold, written in the existing search-term syntax without the field: prefix. It only decides whether a control is drawn, never access, filtering, indexing or whether a write is valid: a hidden field keeps its value and can still be written through the API, and showing it again restores the stored value. If any condition can’t be evaluated (its controlling field is missing, archived or unreadable to the caller), the field is shown. Settable only on update, not on create. Configuration refuses malformed or unsupported conditions and cycles; the no-cycles rule is held by a transaction-scoped lock rather than a database constraint. In the federation design this travels with the field definition (ADR 0083); field definitions aren’t exchanged between instances yet.
  • CONSTRAINT field_definition_display_condition_shape_check CHECK (((display_condition IS NULL) OR ((jsonb_typeof(display_condition) = 'array'::text) AND (jsonb_array_length(display_condition) > 0) AND (NOT jsonb_path_exists(display_condition, '$[*]?(@.type() != "string")'::jsonpath)) AND (NOT jsonb_path_exists(display_condition, '$[*]?(@ like_regex "^\\s*$")'::jsonpath)))))
  • CONSTRAINT field_definition_edit_tab_nonblank_check CHECK (((edit_tab IS NULL) OR (btrim(edit_tab) <> ''::text)))
  • CONSTRAINT field_definition_extraction_mode_check CHECK ((extraction_mode = ANY (ARRAY['skip_if_set'::text, 'replace'::text, 'append'::text, 'prepend'::text])))
  • CONSTRAINT field_definition_mirrors_column_check CHECK (((mirrors_column IS NULL) OR (mirrors_column = ANY (ARRAY['title'::text, 'description'::text]))))
  • CONSTRAINT field_definition_mirrors_column_subject_check CHECK (((mirrors_column IS NULL) OR (subject_kind = 'asset'::text)))
  • CONSTRAINT field_definition_mirrored_input_rules_check CHECK (((mirrors_column IS NULL) OR ((read_only IS FALSE) AND (regexp_filter IS NULL))))
  • CONSTRAINT field_definition_regexp_filter_nonempty_check CHECK (((regexp_filter IS NULL) OR (regexp_filter <> ''::text)))
  • CONSTRAINT field_definition_show_on_card_ungated_check CHECK ((NOT (show_on_card AND (COALESCE(read_capability, ''::text) <> ''::text))))
  • CONSTRAINT field_definition_status_check CHECK ((status = ANY (ARRAY['active'::text, 'deprecated'::text, 'archived'::text])))
  • CONSTRAINT field_definition_subject_kind_check CHECK ((subject_kind = ANY (ARRAY['asset'::text, 'collection'::text])))
  • CONSTRAINT field_definition_type_check CHECK ((type = ANY (ARRAY['text'::text, 'longtext'::text, 'rich_text'::text, 'number'::text, 'boolean'::text, 'date'::text, 'datetime'::text, 'select'::text, 'multi_select'::text, 'tree'::text, 'reference'::text])))

This is the table’s CREATE TABLE statement. Constraints added with separate ALTER TABLE statements, including foreign-key ON DELETE rules, and indexes are defined elsewhere in the dump; see the complete app/schema.sql.

CREATE TABLE public.field_definition (
id uuid DEFAULT gen_random_uuid() NOT NULL,
code text NOT NULL,
label text NOT NULL,
description text DEFAULT ''::text NOT NULL,
type text NOT NULL,
options jsonb DEFAULT '{}'::jsonb NOT NULL,
required boolean DEFAULT false NOT NULL,
searchable boolean DEFAULT true NOT NULL,
applies_to bigint[] DEFAULT '{}'::bigint[] NOT NULL,
read_capability text,
write_capability text,
display_order integer DEFAULT 100 NOT NULL,
display_group text DEFAULT 'general'::text NOT NULL,
status text DEFAULT 'active'::text NOT NULL,
deprecated_replacement_id uuid,
origin_server_id uuid,
created_at timestamp with time zone DEFAULT now() NOT NULL,
updated_at timestamp with time zone DEFAULT now() NOT NULL,
created_by_user_ref bigint,
updated_by_user_ref bigint,
subject_kind text DEFAULT 'asset'::text NOT NULL,
extraction_source text DEFAULT ''::text NOT NULL,
extraction_mode text DEFAULT 'skip_if_set'::text NOT NULL,
default_value jsonb,
open_vocabulary boolean DEFAULT false NOT NULL,
mirrors_column text,
show_on_card boolean DEFAULT false NOT NULL,
show_in_advanced_search boolean DEFAULT true NOT NULL,
show_on_upload boolean DEFAULT true NOT NULL,
edit_tab text,
read_only boolean DEFAULT false NOT NULL,
regexp_filter text,
display_condition jsonb,
CONSTRAINT field_definition_display_condition_shape_check CHECK (((display_condition IS NULL) OR ((jsonb_typeof(display_condition) = 'array'::text) AND (jsonb_array_length(display_condition) > 0) AND (NOT jsonb_path_exists(display_condition, '$[*]?(@.type() != "string")'::jsonpath)) AND (NOT jsonb_path_exists(display_condition, '$[*]?(@ like_regex "^\\s*$")'::jsonpath))))),
CONSTRAINT field_definition_edit_tab_nonblank_check CHECK (((edit_tab IS NULL) OR (btrim(edit_tab) <> ''::text))),
CONSTRAINT field_definition_extraction_mode_check CHECK ((extraction_mode = ANY (ARRAY['skip_if_set'::text, 'replace'::text, 'append'::text, 'prepend'::text]))),
CONSTRAINT field_definition_mirrors_column_check CHECK (((mirrors_column IS NULL) OR (mirrors_column = ANY (ARRAY['title'::text, 'description'::text])))),
CONSTRAINT field_definition_mirrors_column_subject_check CHECK (((mirrors_column IS NULL) OR (subject_kind = 'asset'::text))),
CONSTRAINT field_definition_mirrored_input_rules_check CHECK (((mirrors_column IS NULL) OR ((read_only IS FALSE) AND (regexp_filter IS NULL)))),
CONSTRAINT field_definition_regexp_filter_nonempty_check CHECK (((regexp_filter IS NULL) OR (regexp_filter <> ''::text))),
CONSTRAINT field_definition_show_on_card_ungated_check CHECK ((NOT (show_on_card AND (COALESCE(read_capability, ''::text) <> ''::text)))),
CONSTRAINT field_definition_status_check CHECK ((status = ANY (ARRAY['active'::text, 'deprecated'::text, 'archived'::text]))),
CONSTRAINT field_definition_subject_kind_check CHECK ((subject_kind = ANY (ARRAY['asset'::text, 'collection'::text]))),
CONSTRAINT field_definition_type_check CHECK ((type = ANY (ARRAY['text'::text, 'longtext'::text, 'rich_text'::text, 'number'::text, 'boolean'::text, 'date'::text, 'datetime'::text, 'select'::text, 'multi_select'::text, 'tree'::text, 'reference'::text])))
);

See the schema overview for context.