Singleton Records
Model singleton constraints and single-row tables in the database.
This guide has been moved to Relational Data Modeling & Joins.
In Brick-TS, singleton configuration rows are enforced using standard database uniqueness constraints and retrieved via findOne.
Please see the canonical guide: Relational Data Modeling & Joins.
Schema
These columns match the singleton example in Relational Data Modeling & Joins. The unique discriminator rejects duplicate values, but the application must keep it at 1 to maintain one row.
Table Name: app_settings
| Field | Type | Description |
|---|---|---|
id | text | Row identifier. PK Default: global_settings (application) |
singleton_key | integer | Singleton discriminator. Unique Optional Default: 1 |
site_name | text | Site display name. |
maintenanceMode | boolean | Whether maintenance mode is enabled. Optional Default: false |