Skip to content

Config types, Type Designer types, and extension attributes

Three ways to add fields exist — config types, admin-created types, and extension attributes — differing in where they live and who may change them.

Three mechanisms add fields to content, and they differ in where the definition lives, where the value lives, and which tool owns the DDL. Choosing between them is a deploy decision, not a modelling preference.

Where each one lives

A config type is declared in kywi.config.ts. Its kywi_ct_<name> table is generated as a drizzle schema file and migrated by drizzle-kit; the definition is reviewed in git and changes with a deploy.

A Type Designer type is rows in kywi_content_types and kywi_content_type_fields — and it still gets a real kywi_ct_<name> table with real columns. That table is created on the first Apply Schema Changes and grown the same way afterwards: adding a field issues an ALTER TABLE … ADD COLUMN. Removing one never drops anything — a deleted field leaves its column and its data behind, deliberately.

An extension attribute adds no column at all. Definitions and values are rows in five fixed tables — subtypes, attribute sets, attributes, data and related sets — and a value lands in whichever of five columns matches its type: number_value, date_value, boolean_value, json_value, or string_value for everything else (text, select, file and rich text all store as string). It is the only one of the three that needs no migration, ever.

One table, one manager

Schema generation reads the database as well as the config, but not to generate drizzle schema for admin-created tables — to exclude them. Every admin table, and every orphaned kywi_ct_* table left behind by a deleted type, is written into the generated drizzle.config.ts as a negation, so drizzle-kit never sees it in a diff:

drizzle.config.ts (generated)ts
tablesFilter: ["kywi_*","!kywi_ct_article","!kywi_ct_capability"],

Reloads, restarts and provenance

Why a Type Designer type is usable at once while a config type waits for a deploy, and how the two are told apart in code, is the general config-vs-database mechanism — see Config as code vs the database.

Reserved field names are enforced on the designer's field route with a 409, and the list is deliberately dependency-free so the browser surface and the server route check the same thing. Designing a content type has the list and the one path that does not check it.

What extension attributes cost you

No column means no migration — and no column to filter, sort or index on. A value reached through a join on attribute id is not a field: it will not back a feed, an audience rule or an ordered listing the way a real column does. The five tables also carry no site_id, so the extension model is deployment-global rather than per-site; values are tied to a content row and cascade away with it, which is more than a relationship field column gets.

Reach for an extension attribute for sparse, subtype-specific data nobody queries across. Reach for a field for anything you will filter, sort or feed on — and for a config field specifically when code depends on the shape. See Config as code vs the database for the general version of that line.