22 lines
1.6 KiB
SQL
22 lines
1.6 KiB
SQL
-- Catalog of available overview rows for personal dashboards
|
|
-- Run against the LASUCA MySQL schema (same database that stores `members`).
|
|
|
|
CREATE TABLE IF NOT EXISTS `dashboard_row_catalog` (
|
|
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
|
`row_key` VARCHAR(64) NOT NULL COMMENT 'Stable identifier used in code / user selections',
|
|
`friendly_name` VARCHAR(255) NOT NULL COMMENT 'Display label shown in pickers',
|
|
`source_type` VARCHAR(32) NOT NULL DEFAULT 'historian' COMMENT 'historian|mysql|computed etc.',
|
|
`source_id` VARCHAR(128) NOT NULL COMMENT 'Identifier used by the source system (e.g., historian ID or tag name)',
|
|
`unit` VARCHAR(32) DEFAULT NULL COMMENT 'Unit of measure (psi, %, rpm, ft, etc.)',
|
|
`is_level_indicator` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '1 = render as level indicator instead of plain numeric',
|
|
`value_precision` TINYINT UNSIGNED DEFAULT NULL COMMENT 'Optional decimal precision hint',
|
|
`display_template` VARCHAR(128) DEFAULT NULL COMMENT 'Optional PHP include or template key for rendering',
|
|
`requires_include` VARCHAR(128) DEFAULT NULL COMMENT 'Name of include file required to populate data arrays',
|
|
`sort_order` SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Default ordering in selection lists',
|
|
`metadata_json` LONGTEXT DEFAULT NULL COMMENT 'Free-form JSON for additional configuration (thresholds, colors, etc.)',
|
|
`created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
`updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
PRIMARY KEY (`id`),
|
|
UNIQUE KEY `uniq_dashboard_row_key` (`row_key`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|