CREATE TABLE IF NOT EXISTS `{{prefix}}settings` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `group_name` VARCHAR(80) NOT NULL,
  `setting_key` VARCHAR(120) NOT NULL,
  `setting_value` TEXT NULL,
  `is_secret` TINYINT(1) NOT NULL DEFAULT 0,
  `created_at` DATETIME NULL,
  `updated_at` DATETIME NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uniq_group_key` (`group_name`,`setting_key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

INSERT INTO `{{prefix}}settings` (`group_name`,`setting_key`,`setting_value`,`is_secret`,`created_at`,`updated_at`) VALUES
('system','treatment_flow_finalization_ready','1',0,NOW(),NOW()),
('system','doctor_workspace_flow_rail_ready','1',0,NOW(),NOW()),
('system','clinical_empty_state_guard_ready','1',0,NOW(),NOW()),
('system','application_version','0.5.9.8.73',0,NOW(),NOW())
ON DUPLICATE KEY UPDATE `setting_value`=VALUES(`setting_value`),`updated_at`=NOW();
