CREATE TABLE IF NOT EXISTS `visu_virtual_points` ( `id` int NOT NULL AUTO_INCREMENT, `project_id` int NOT NULL, `point_key` varchar(190) NOT NULL, `name` varchar(190) NOT NULL, `description` text DEFAULT NULL, `unit` varchar(32) NOT NULL DEFAULT '', `decimals` tinyint NOT NULL DEFAULT 2, `sort_order` int NOT NULL DEFAULT 100, `formula_json` longtext NOT NULL, `created_by` int DEFAULT NULL, `is_active` tinyint(1) NOT NULL DEFAULT 1, `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `uniq_visu_virtual_point_project_key` (`project_id`, `point_key`), KEY `idx_visu_virtual_points_project` (`project_id`, `is_active`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;