-- Security module: per-product check templates (the curated product catalog). -- Each template carries the dynamic technical checklist for one software product. -- Tenant-scoped; BC is not involved (the template catalog IS the product list). CREATE TABLE IF NOT EXISTS `security_check_templates` ( `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, `tenant_id` INT UNSIGNED NOT NULL, `product_code` VARCHAR(60) NOT NULL, `product_name` VARCHAR(255) NOT NULL DEFAULT '', `tech_schema_json` TEXT NULL DEFAULT NULL, `active` TINYINT(1) NOT NULL DEFAULT 1, `version` INT UNSIGNED NOT NULL DEFAULT 1, `created_by` INT UNSIGNED NULL DEFAULT NULL, `updated_by` INT UNSIGNED NULL DEFAULT NULL, `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` DATETIME NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `uniq_sct_tenant_code` (`tenant_id`, `product_code`), KEY `idx_sct_tenant_active` (`tenant_id`, `active`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;