Skip to content

Database Schema ​

The SDK ships 28 migrations creating 31 tables, all prefixed sdk_. They come in laravelui5/sdk-db, a package the SDK requires and releases in step with it, and load from there — php artisan migrate applies them and there is nothing to publish. Who runs them is ui5.migrations.

One table the SDK does not create is users. The SDK ships no auth table and makes no assumption about yours; the link is a partner_id column you add to your own table. See Installation.

The invariants that shape everything ​

Four rules run through the whole schema. Knowing them means you can predict a table's shape before you read it.

1 · Every grant is time-bound, and no timestamp is nullable. Every grant table carries valid_from (defaults to now) and valid_until (defaults to 9999-12-31 23:59:59). There is no "forever" and no "unset" — a grant that has ended carries the moment it ended, which is what makes ui5:explain --at= able to answer questions about last Tuesday. See time-aware grants.

2 · Every grant records who granted it. assigned_by_partner_id on every assignment table, with a restricting foreign key: a partner who has granted something cannot be deleted out from under the audit trail.

3 · Partner identity is enforced inside the SDK. Every partner_id in an sdk_* table is a strict foreign key to sdk_partners.id, restricting on delete: a partner is archived, never deleted, because a cascade would remove rows the audit never sees. The one nullable, soft link in the system is the users.partner_id bridge in your own table.

4 · Catalog tables are owned by code. sdk_partner_roles, sdk_partner_relationship_types and sdk_address_providers are Customizing catalogs: ui5:sync reconciles them to exactly what your attributes declare, and deletes rows you did not declare. They carry a surrogate id plus a unique business code, and no timestamps — the worker writes through the query builder, not Eloquent.

The registry catalog ​

What ui5:sync writes from your declarations.

sdk_artifacts — one row per registered artifact. namespace (unique), type (the ArtifactType enum), expose, title, description. No foreign key to a module: modules are runtime-only, artifacts are addressed by namespace string. changed in 3.0No version column: an artifact runs under its module's version, which the registry knows.

sdk_abilities — artifact_id, ability, type (the AbilityType enum). Unique per (artifact_id, ability, type). Every ability belongs to exactly one artifact.

sdk_roles — role (unique) and a nullable scope. sdk_ability_role links roles to abilities.

sdk_groups — code (unique) and a description. sdk_group_role and sdk_ability_group link a group to roles and to abilities directly, which is what makes a group a single grantable bundle of both.

sdk_slots — the slot catalog: name (unique), type, default_value (JSON), note, editable, a declared_by_snapshot, and synced_at / removed_at. The removed_at column is why a retired slot leaves a tombstone rather than vanishing.

Security assignments ​

Three tables, one shape. Each grants one thing to one partner for one window.

TableGrantsUnique on
sdk_ability_assignmentsone ability(partner_id, ability_id, valid_until)
sdk_role_assignmentsone role, optionally in a context(partner_id, role_id, context_type, context_id, valid_until)
sdk_group_assignmentsone group(partner_id, group_id, valid_until)

valid_until is part of every unique key, which is what lets the same grant be issued again for a later window without colliding with its own history.

sdk_role_assignments carries the extra pair context_type / context_id — that is role scope: this role, but only for that project. It has its own composite index for the scope lookup, because that query runs on every scoped read.

sdk_delegations is the impersonation table: delegate_partner_id, target_partner_id, granted_by, a note, and the same validity pair. See impersonation.

Settings ​

A setting lives in two tables: what code declares, and what people set.

sdk_settings is the declaration, one row per setting an artifact declares, written by ui5:sync. It carries enough metadata for a console that has never seen your code to offer the setting for editing:

  • artifact_id and setting — whose setting it is and its key, unique together;
  • default_value (JSON) and value_type — what a read answers where nobody set a value, and how a value is validated;
  • level — the lowest edit level that may set a value, shown as a badge;
  • value_help, value_help_scope, model_class — how the console offers a value for a Model-typed setting.

sdk_setting_values holds the values, one row per setting, scope and partner:

  • setting_id — the declaration the value overrides;
  • scope — the Scope enum: Installation, Tenant, Site or User. Never Platform: that level is the declaration's default;
  • partner_id — set only on a User-scope row;
  • set_by — the partner who last wrote the row. It equals partner_id when someone sets their own value and differs when someone sets it on their behalf;
  • value (JSON).

It is unique on (setting_id, scope, partner_key). partner_key is partner_id ?? 0, set by the model: a unique index treats nulls as distinct, so without it two Installation values for the same setting would not collide. The values are audited, but the declarations are not, because ui5:sync owns them. Up to SDK 1.x a single table carried both.

sdk_slot_assignments is the actor layer: (partner_id, slot_name) unique, a JSON value, and assigned_by_partner_id. One value per actor and slot — a write replaces, a clear deletes, and there is no history. See actor slot values.

Partners ​

sdk_partners is the business actor — person, organisation or department in one table. It carries the identity fields (ext_ref, type, system_level, search_term, name, first_name, avatar_path, gender), the contact fields (email, phone, mobile), the legal-identity block (vat_number, company_registration_number, registered_office), the dates (foundation_date, liquidation_date, birthdate), language_code, and archived.

search_term is an internal matchcode — upper-cased and stripped of punctuation for searching. It is not a display field, and an export that includes it reads as noise.

sdk_partner_roles (catalog) and sdk_partner_role_assignments are the business role axis, separate from the security roles above: who is a customer, a supplier, a key account. The assignment carries context_type / context_id and an is_primary flag, and is unique per (partner, role, context).

sdk_partner_relationship_types (catalog) and sdk_partner_relationships hold the graph between partners — employment (employed_by), commission (acts_for), ownership, the rungs of a tenant's ladder (operator_for, consultant_for, it_contact_for). The type carries both a directional_name and a reverse_name, so one row reads correctly from either end.

sdk_partner_profiles holds the many-valued online profiles — website, LinkedIn and the other platforms of its type enum — as type / value / label / sort; value is always a full URL, never a bare handle. (sdk_slot_assignments is not a grant table and has no validity window.)

sdk_partner_addresses and sdk_address_providers are the address domain. Three invariants live in the model rather than the schema, because MySQL cannot express any of them: at most one Primary row per partner (no partial unique index), the structured-or-free-text capture rule, and the coordinate pairing — both columns or neither, and a row with no postal address must carry them (no conditional NOT NULL for either).

Texts and translations ​

Two tables for the texts the server reads in the request's language. Which one a text lands in depends on who declares the vocabulary: code or the people using the app.

sdk_texts holds the translated texts of everything ui5:sync writes from code. The family column (the TextFamily enum) says which: Customizing catalogs, abilities, settings, artifacts, roles. A text is keyed on (family, catalog, code, column, locale), and locale comes from the module's bundle (default is the base). The table is code-owned in the sense of invariant 4: the worker that writes the rows writes their texts in the same run and removes a text the bundle no longer carries.

sdk_translations holds the further languages of your own master data. The base language stays in the model's own column; only the other languages land here. A row names the model's table (which stays stable when the class is renamed), the row's key as a string (row_key), the property, the language (ISO 639-1, optionally with a region, de-CH) and the text. It is unique on the first four. Your model fills it through the HasTranslations trait and the fields it lists in #[Translatable].

The audit ​

Six tables, described in full on The Audit. They are append-only: the models refuse an update and a row-by-row delete. The change log is never deleted; the four other logs are pruned by ui5:prune after their retention.

They share an envelope, so a support case reads the same in every one of them:

  • The run — correlation_id, a UUID Laravel's Context carries for the whole run. It is the same value in laravel.log, in every log row and in every head a job the run dispatched writes. It is not unique.
  • Who — set_by, the acting person or, for a run without one, the automation actor. on_behalf_of and delegation_id are filled only under impersonation. All three are restricting foreign keys to sdk_partners and sdk_delegations.
  • From where — method and url (the request line), ip, user_agent, language, and session_hash, the SHA-256 of the session id (never the id itself). All are null outside a request; on the console user_agent names the OS user and host (cli; deploy@app-1).

sdk_change_log is the head: one row per committed unit of work that wrote. source (the ChangeSource enum: Action, Command, Job, Migration, Export, Unmanaged) and namespace name the trigger. unit names the unit of work where it differs from the trigger. version comes from the registry, never from the URL's @version, which is a cache-buster. module is the owning module. input holds the validated payload or a command's arguments, touched the side effects, statements and tables_written what the run wrote, summary the result of a bulk run that writes no positions. Then started_at and duration_ms.

sdk_change_log_entries holds the positions: one row per changed audited model. subject_type is the model's table, never its class or a morph alias. subject_key is its stable key: the key columns of #[Audited], several joined by : (AT:U20), else the primary key. old and new are JSON objects keyed by attribute. They are indexed by subject, which is how a record's history is read.

sdk_business_log holds the messages a unit of work logs on purpose: severity, message_key, message_params and message_bundle: the bundle the message named, else the app that declares the run's trigger, else the SDK's library. Like a position, a message can name a subject. committed is true or false once the run's transaction ends, and null outside one. A message is written when the transaction ends, whichever way, so a rollback keeps the message that explains it.

sdk_security_log holds sign-ins, impersonations and refusals. event is the SecurityEventType enum. user_id is your user's identifier and has no foreign key, because users is your table. identifier is the login name as typed; for a failed attempt on an unknown name or a lockout it is the only "who" there is. It is personal data, bounded by the retention. guard names the guard, actor_id the user's person partner. target and ability name what was refused or entered. context holds what only this kind of event knows, redacted and never with credentials.

sdk_validation_log holds refused requests: the action's namespace and failures, one entry per failing field with its rules and the value as entered, secrets redacted. It is off by default; the operator turns it on with the setting audit.validation_log.

sdk_report_log holds the reports, exports and files served: kind (Report, Export or File since 3.0), the artifact's namespace, the parameters it ran with (redacted), the format, and for an export the row_count. Then duration_ms. A file's row names the owning app, {"file": "<ulid>"} and the name's extension as the format.

Reading the whole thing at once ​

bash
php artisan migrate:status          # what has run
php artisan db:table sdk_partners   # one table's real shape in your database

The migrations themselves are the authority, and they are commented: each one opens with why the table is shaped the way it is, and which invariants the schema could not carry. If you are about to write a query against an sdk_* table, read its migration first — the comment usually answers the question you were about to ask.

Your own tables ​

Your tables are yours: write their migrations in your app as you always have, and php artisan migrate runs them beside the SDK's. Two rules keep the two apart:

  • Point at the SDK, never the other way. A foreign key from your table to an sdk_* table is how you attach your data — partner_id → sdk_partners.id, restricting on delete, because a partner is archived, never deleted. The SDK's tables never point at yours.
  • Change only your own tables. An sdk_* table belongs to laravelui5/sdk-db: no columns added, none altered, no rows written past the models (see below).

What not to do ​

  • Do not write to a Customizing catalog. ui5:sync will delete what you insert. Declare it in code.
  • Do not write to sdk_texts or sdk_settings. They are ui5:sync's; change the bundle or the declaration. A value goes through the Settings app, never into sdk_setting_values directly, because a direct write is not audited.
  • Do not update or delete log rows with DB::table(). The models refuse it for a reason: the logs are evidence. Old rows go through ui5:prune.
  • Do not insert a grant with a null validity. Use the defaults; nothing in the engine expects a null and the unique keys depend on valid_until.
  • Do not write to sdk_partner_addresses with DB::table(). You bypass all three model guards. The same caution applies to sdk_partner_relationships.
  • Do not add columns to an sdk_* table. They belong to the package and a future migration may touch them. Your own data belongs in your own tables, joined on partner_id.