From d0f690cf6ac6d5132c340c46e35a5f18da01f070 Mon Sep 17 00:00:00 2001
From: ning <710leo@gmail.com>
Date: Mon, 2 Dec 2024 19:33:07 +0800
Subject: [PATCH] docs: update n9e.sql

---
 docker/initsql/a-n9e.sql      | 232 +++++++++++++++++-----------------
 docker/migratesql/migrate.sql |   6 +-
 models/builtin_component.go   |   2 +-
 models/builtin_metrics.go     |   8 +-
 models/migrate/migrate.go     |  21 +--
 5 files changed, 138 insertions(+), 131 deletions(-)

diff --git a/docker/initsql/a-n9e.sql b/docker/initsql/a-n9e.sql
index 836d9877d..06cff24c2 100644
--- a/docker/initsql/a-n9e.sql
+++ b/docker/initsql/a-n9e.sql
@@ -58,8 +58,8 @@ CREATE TABLE `configs` (
     `ckey` varchar(191) not null,
     `note` varchar(1024) NOT NULL DEFAULT '' COMMENT 'note',
     `cval` text COMMENT 'config value',
-    `external` bigint NOT NULL DEFAULT 0 COMMENT '0 means built-in 1 means external',
-    `encrypted` bigint DEFAULT 0 COMMENT '0 means plaintext 1 means ciphertext',
+    `external`  bigint DEFAULT 0 COMMENT '0\\:built-in 1\\:external',
+    `encrypted` bigint DEFAULT 0 COMMENT '0\\:plaintext 1\\:ciphertext',
     `create_at` bigint DEFAULT 0 COMMENT 'create_at',
     `create_by` varchar(64) NOT NULL DEFAULT '' COMMENT 'cerate_by',
     `update_at` bigint DEFAULT 0 COMMENT 'update_at',
@@ -290,7 +290,7 @@ CREATE TABLE `alert_rule` (
     `runbook_url` varchar(4096),
     `append_tags` varchar(255) not null default '' comment 'split by space: service=n9e mod=api',
     `annotations` text not null comment 'annotations',
-    `extra_config` text not null comment 'extra_config',
+    `extra_config` text,
     `create_at` bigint not null default 0,
     `create_by` varchar(64) not null default '',
     `update_at` bigint not null default 0,
@@ -344,10 +344,10 @@ CREATE TABLE `alert_subscribe` (
     `redefine_channels` tinyint(1) default 0 comment 'is redefine channels?',
     `new_channels` varchar(255) not null default '' comment 'split by space: sms voice email dingtalk wecom',
     `user_group_ids` varchar(250) not null comment 'split by space 1 34 5, notify cc to user_group_ids',
-    `busi_groups` varchar(4096) NOT NULL,
+    `busi_groups` varchar(4096),
     `note` VARCHAR(1024) DEFAULT '' COMMENT 'note',
     `webhooks` text not null,
-    `extra_config` text not null comment 'extra_config',
+    `extra_config` text,
     `redefine_webhooks` tinyint(1) default 0,
     `for_duration` bigint not null default 0,
     `create_at` bigint not null default 0,
@@ -523,7 +523,7 @@ CREATE TABLE `board_busigroup` (
 
 CREATE TABLE `builtin_components` (
   `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'unique identifier',
-  `ident` varchar(191) NOT NULL,
+  `ident` varchar(191) NOT NULL COMMENT '''identifier of component''',
   `logo` varchar(191) NOT NULL COMMENT '''logo of component''',
   `readme` text NOT NULL COMMENT '''readme of component''',
   `created_at` bigint NOT NULL DEFAULT 0 COMMENT '''create time''',
@@ -749,9 +749,9 @@ CREATE TABLE `task_meta`
     `id`          bigint unsigned NOT NULL AUTO_INCREMENT,
     `title`       varchar(255)    not null default '',
     `account`     varchar(64)     not null,
-    `batch`       int unsigned    not null default 0,
-    `tolerance`   int unsigned    not null default 0,
-    `timeout`     int unsigned    not null default 0,
+    `batch`       bigint          not null default 0,
+    `tolerance`   bigint          not null default 0,
+    `timeout`     bigint    not null default 0,
     `pause`       varchar(255)    not null default '',
     `script`      text            not null,
     `args`        varchar(512)    not null default '',
@@ -759,8 +759,8 @@ CREATE TABLE `task_meta`
     `creator`     varchar(64)     not null default '',
     `created`     timestamp       not null default CURRENT_TIMESTAMP,
     PRIMARY KEY (`id`),
-    KEY (`creator`),
-    KEY (`created`)
+    KEY `idx_task_meta_creator` (`creator`),
+    KEY `idx_task_meta_created` (`created`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
 
@@ -784,9 +784,9 @@ CREATE TABLE `task_scheduler`
 
 CREATE TABLE `task_scheduler_health`
 (
-    `scheduler` varchar(128) not null,
-    `clock`     bigint       not null,
-    UNIQUE KEY (`scheduler`),
+    `scheduler` varchar(128) NOT NULL,
+    `clock`     bigint not null,
+    UNIQUE KEY `idx_task_scheduler_health_scheduler` (`scheduler`),
     KEY (`clock`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -797,8 +797,8 @@ CREATE TABLE `task_host_doing`
     `host`   varchar(128)    not null,
     `clock`  bigint          not null default 0,
     `action` varchar(16)     not null,
-    KEY (`id`),
-    KEY (`host`)
+    KEY `idx_task_host_doing_id` (`id`),
+   KEY `idx_task_host_doing_host` (`host`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
 
@@ -810,7 +810,7 @@ CREATE TABLE task_host_0
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -823,7 +823,7 @@ CREATE TABLE task_host_1
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -836,7 +836,7 @@ CREATE TABLE task_host_2
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -849,7 +849,7 @@ CREATE TABLE task_host_3
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -862,7 +862,7 @@ CREATE TABLE task_host_4
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -875,7 +875,7 @@ CREATE TABLE task_host_5
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -888,7 +888,7 @@ CREATE TABLE task_host_6
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -901,7 +901,7 @@ CREATE TABLE task_host_7
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -914,7 +914,7 @@ CREATE TABLE task_host_8
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -927,7 +927,7 @@ CREATE TABLE task_host_9
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -940,7 +940,7 @@ CREATE TABLE task_host_10
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -953,7 +953,7 @@ CREATE TABLE task_host_11
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -966,7 +966,7 @@ CREATE TABLE task_host_12
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -979,7 +979,7 @@ CREATE TABLE task_host_13
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -992,7 +992,7 @@ CREATE TABLE task_host_14
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1005,7 +1005,7 @@ CREATE TABLE task_host_15
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1018,7 +1018,7 @@ CREATE TABLE task_host_16
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1031,7 +1031,7 @@ CREATE TABLE task_host_17
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1044,7 +1044,7 @@ CREATE TABLE task_host_18
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1057,7 +1057,7 @@ CREATE TABLE task_host_19
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1070,7 +1070,7 @@ CREATE TABLE task_host_20
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1083,7 +1083,7 @@ CREATE TABLE task_host_21
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1096,7 +1096,7 @@ CREATE TABLE task_host_22
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1109,7 +1109,7 @@ CREATE TABLE task_host_23
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1122,7 +1122,7 @@ CREATE TABLE task_host_24
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1135,7 +1135,7 @@ CREATE TABLE task_host_25
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1148,7 +1148,7 @@ CREATE TABLE task_host_26
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1161,7 +1161,7 @@ CREATE TABLE task_host_27
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1174,7 +1174,7 @@ CREATE TABLE task_host_28
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1187,7 +1187,7 @@ CREATE TABLE task_host_29
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1200,7 +1200,7 @@ CREATE TABLE task_host_30
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1213,7 +1213,7 @@ CREATE TABLE task_host_31
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1226,7 +1226,7 @@ CREATE TABLE task_host_32
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1239,7 +1239,7 @@ CREATE TABLE task_host_33
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1252,7 +1252,7 @@ CREATE TABLE task_host_34
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1265,7 +1265,7 @@ CREATE TABLE task_host_35
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1278,7 +1278,7 @@ CREATE TABLE task_host_36
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1291,7 +1291,7 @@ CREATE TABLE task_host_37
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1304,7 +1304,7 @@ CREATE TABLE task_host_38
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1317,7 +1317,7 @@ CREATE TABLE task_host_39
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1330,7 +1330,7 @@ CREATE TABLE task_host_40
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1343,7 +1343,7 @@ CREATE TABLE task_host_41
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1356,7 +1356,7 @@ CREATE TABLE task_host_42
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1369,7 +1369,7 @@ CREATE TABLE task_host_43
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1382,7 +1382,7 @@ CREATE TABLE task_host_44
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1395,7 +1395,7 @@ CREATE TABLE task_host_45
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1408,7 +1408,7 @@ CREATE TABLE task_host_46
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1421,7 +1421,7 @@ CREATE TABLE task_host_47
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1434,7 +1434,7 @@ CREATE TABLE task_host_48
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1447,7 +1447,7 @@ CREATE TABLE task_host_49
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1460,7 +1460,7 @@ CREATE TABLE task_host_50
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1473,7 +1473,7 @@ CREATE TABLE task_host_51
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1486,7 +1486,7 @@ CREATE TABLE task_host_52
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1499,7 +1499,7 @@ CREATE TABLE task_host_53
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1512,7 +1512,7 @@ CREATE TABLE task_host_54
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1525,7 +1525,7 @@ CREATE TABLE task_host_55
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1538,7 +1538,7 @@ CREATE TABLE task_host_56
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1551,7 +1551,7 @@ CREATE TABLE task_host_57
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1564,7 +1564,7 @@ CREATE TABLE task_host_58
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1577,7 +1577,7 @@ CREATE TABLE task_host_59
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1590,7 +1590,7 @@ CREATE TABLE task_host_60
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1603,7 +1603,7 @@ CREATE TABLE task_host_61
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1616,7 +1616,7 @@ CREATE TABLE task_host_62
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1629,7 +1629,7 @@ CREATE TABLE task_host_63
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1642,7 +1642,7 @@ CREATE TABLE task_host_64
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1655,7 +1655,7 @@ CREATE TABLE task_host_65
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1668,7 +1668,7 @@ CREATE TABLE task_host_66
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1681,7 +1681,7 @@ CREATE TABLE task_host_67
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1694,7 +1694,7 @@ CREATE TABLE task_host_68
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1707,7 +1707,7 @@ CREATE TABLE task_host_69
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1720,7 +1720,7 @@ CREATE TABLE task_host_70
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1733,7 +1733,7 @@ CREATE TABLE task_host_71
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1746,7 +1746,7 @@ CREATE TABLE task_host_72
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1759,7 +1759,7 @@ CREATE TABLE task_host_73
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1772,7 +1772,7 @@ CREATE TABLE task_host_74
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1785,7 +1785,7 @@ CREATE TABLE task_host_75
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1798,7 +1798,7 @@ CREATE TABLE task_host_76
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1811,7 +1811,7 @@ CREATE TABLE task_host_77
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1824,7 +1824,7 @@ CREATE TABLE task_host_78
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1837,7 +1837,7 @@ CREATE TABLE task_host_79
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1850,7 +1850,7 @@ CREATE TABLE task_host_80
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1863,7 +1863,7 @@ CREATE TABLE task_host_81
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1876,7 +1876,7 @@ CREATE TABLE task_host_82
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1889,7 +1889,7 @@ CREATE TABLE task_host_83
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1902,7 +1902,7 @@ CREATE TABLE task_host_84
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1915,7 +1915,7 @@ CREATE TABLE task_host_85
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1928,7 +1928,7 @@ CREATE TABLE task_host_86
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1941,7 +1941,7 @@ CREATE TABLE task_host_87
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1954,7 +1954,7 @@ CREATE TABLE task_host_88
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1967,7 +1967,7 @@ CREATE TABLE task_host_89
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1980,7 +1980,7 @@ CREATE TABLE task_host_90
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -1993,7 +1993,7 @@ CREATE TABLE task_host_91
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -2006,7 +2006,7 @@ CREATE TABLE task_host_92
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -2019,7 +2019,7 @@ CREATE TABLE task_host_93
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -2032,7 +2032,7 @@ CREATE TABLE task_host_94
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -2045,7 +2045,7 @@ CREATE TABLE task_host_95
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -2058,7 +2058,7 @@ CREATE TABLE task_host_96
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -2071,7 +2071,7 @@ CREATE TABLE task_host_97
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -2084,7 +2084,7 @@ CREATE TABLE task_host_98
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
@@ -2097,7 +2097,7 @@ CREATE TABLE task_host_99
     `status` varchar(32)     not null,
     `stdout` text,
     `stderr` text,
-    UNIQUE KEY (`id`, `host`),
+    UNIQUE KEY `idx_id_host` (`id`, `host`),
     PRIMARY KEY (`ii`)
 ) ENGINE = InnoDB
   DEFAULT CHARSET = utf8mb4;
\ No newline at end of file
diff --git a/docker/migratesql/migrate.sql b/docker/migratesql/migrate.sql
index f62b6d5ea..e0a8c6eb9 100644
--- a/docker/migratesql/migrate.sql
+++ b/docker/migratesql/migrate.sql
@@ -116,4 +116,8 @@ CREATE TABLE `target_busi_group` (
   `update_at` bigint NOT NULL,
   PRIMARY KEY (`id`),
   UNIQUE KEY `idx_target_group` (`target_ident`,`group_id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
\ No newline at end of file
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+/* v7.7.2 2024-12-02 */
+ALTER TABLE alert_subscribe MODIFY COLUMN rule_ids varchar(1024);
+ALTER TABLE alert_subscribe MODIFY COLUMN busi_groups varchar(4096);
\ No newline at end of file
diff --git a/models/builtin_component.go b/models/builtin_component.go
index 229bf3b63..3e5e1a7a4 100644
--- a/models/builtin_component.go
+++ b/models/builtin_component.go
@@ -11,7 +11,7 @@ import (
 // BuiltinComponent represents a builtin component along with its metadata.
 type BuiltinComponent struct {
 	ID        uint64 `json:"id" gorm:"primaryKey;type:bigint;autoIncrement;comment:'unique identifier'"`
-	Ident     string `json:"ident" gorm:"type:varchar(191);not null;uniqueIndex:idx_ident,sort:asc"`
+	Ident     string `json:"ident" gorm:"type:varchar(191);not null;uniqueIndex:idx_ident,sort:asc;comment:'identifier of component'"`
 	Logo      string `json:"logo" gorm:"type:varchar(191);not null;comment:'logo of component'"`
 	Readme    string `json:"readme" gorm:"type:text;not null;comment:'readme of component'"`
 	CreatedAt int64  `json:"created_at" gorm:"type:bigint;not null;default:0;comment:'create time'"`
diff --git a/models/builtin_metrics.go b/models/builtin_metrics.go
index 751b11a5d..38715a7a2 100644
--- a/models/builtin_metrics.go
+++ b/models/builtin_metrics.go
@@ -14,12 +14,12 @@ import (
 type BuiltinMetric struct {
 	ID         int64  `json:"id" gorm:"primaryKey;type:bigint;autoIncrement;comment:'unique identifier'"`
 	UUID       int64  `json:"uuid" gorm:"type:bigint;not null;default:0;comment:'uuid'"`
-	Collector  string `json:"collector" gorm:"uniqueIndex:idx_collector_typ_name;type:varchar(191);not null;index:idx_collector,sort:asc;comment:'type of collector'"`
-	Typ        string `json:"typ" gorm:"uniqueIndex:idx_collector_typ_name;type:varchar(191);not null;index:idx_typ,sort:asc;comment:'type of metric'"`
-	Name       string `json:"name" gorm:"uniqueIndex:idx_collector_typ_name;type:varchar(191);not null;index:idx_builtinmetric_name,sort:asc;comment:'name of metric'"`
+	Collector  string `json:"collector" gorm:"type:varchar(191);not null;index:idx_collector,sort:asc;comment:'type of collector'"` // Type of collector (e.g., 'categraf', 'telegraf')
+	Typ        string `json:"typ" gorm:"type:varchar(191);not null;index:idx_typ,sort:asc;comment:'type of metric'"`                // Type of metric (e.g., 'host', 'mysql', 'redis')
+	Name       string `json:"name" gorm:"type:varchar(191);not null;index:idx_builtinmetric_name,sort:asc;comment:'name of metric'"`
 	Unit       string `json:"unit" gorm:"type:varchar(191);not null;comment:'unit of metric'"`
 	Note       string `json:"note" gorm:"type:varchar(4096);not null;comment:'description of metric'"`
-	Lang       string `json:"lang" gorm:"uniqueIndex:idx_collector_typ_name;type:varchar(191);not null;default:'zh';index:idx_lang,sort:asc;comment:'language'"`
+	Lang       string `json:"lang" gorm:"type:varchar(191);not null;default:'zh';index:idx_lang,sort:asc;comment:'language'"`
 	Expression string `json:"expression" gorm:"type:varchar(4096);not null;comment:'expression of metric'"`
 	CreatedAt  int64  `json:"created_at" gorm:"type:bigint;not null;default:0;comment:'create time'"`
 	CreatedBy  string `json:"created_by" gorm:"type:varchar(191);not null;default:'';comment:'creator'"`
diff --git a/models/migrate/migrate.go b/models/migrate/migrate.go
index d849d2844..7f0070c11 100644
--- a/models/migrate/migrate.go
+++ b/models/migrate/migrate.go
@@ -28,7 +28,7 @@ func MigrateIbexTables(db *gorm.DB) {
 		db = db.Set("gorm:table_options", tableOptions)
 	}
 
-	dts := []interface{}{&imodels.TaskMeta{}, &imodels.TaskScheduler{}, &imodels.TaskSchedulerHealth{}, &TaskHostDoing{}, &imodels.TaskAction{}}
+	dts := []interface{}{&imodels.TaskMeta{}, &imodels.TaskScheduler{}, &TaskHostDoing{}, &imodels.TaskAction{}}
 	for _, dt := range dts {
 		err := db.AutoMigrate(dt)
 		if err != nil {
@@ -61,6 +61,10 @@ func MigrateTables(db *gorm.DB) error {
 		&models.MetricFilter{}, &models.BuiltinComponent{}, &models.NotificaitonRecord{},
 		&models.TargetBusiGroup{}}
 
+	if !db.Migrator().HasColumn(&imodels.TaskSchedulerHealth{}, "scheduler") {
+		dts = append(dts, &imodels.TaskSchedulerHealth{})
+	}
+
 	if !columnHasIndex(db, &AlertHisEvent{}, "original_tags") ||
 		!columnHasIndex(db, &AlertCurEvent{}, "original_tags") {
 		asyncDts := []interface{}{&AlertHisEvent{}, &AlertCurEvent{}}
@@ -186,17 +190,16 @@ func InsertPermPoints(db *gorm.DB) {
 }
 
 type AlertRule struct {
-	ExtraConfig       string                   `gorm:"type:text;column:extra_config;not null;comment:extra_config"` // extra config
-	DatasourceQueries []models.DatasourceQuery `gorm:"datasource_queries;type:text;serializer:json"`                // datasource queries
+	ExtraConfig       string                   `gorm:"type:text;column:extra_config"`
+	DatasourceQueries []models.DatasourceQuery `gorm:"datasource_queries;type:text;serializer:json"` // datasource queries
 }
 
 type AlertSubscribe struct {
-	ExtraConfig string       `gorm:"type:text;column:extra_config;not null;comment:extra_config"` // extra config
+	ExtraConfig string       `gorm:"type:text;column:extra_config"` // extra config
 	Severities  string       `gorm:"column:severities;type:varchar(32);not null;default:''"`
-	RuleID      int64        `gorm:"type:bigint;not null;default:0"`
-	RuleIds     []int64      `gorm:"column:rule_ids;type:varchar(1024);"`
-	BusiGroups  ormx.JSONArr `gorm:"column:busi_groups;type:varchar(4096);not null;"`
+	BusiGroups  ormx.JSONArr `gorm:"column:busi_groups;type:varchar(4096)"`
 	Note        string       `gorm:"column:note;type:varchar(1024);default:'';comment:note"`
+	RuleIds     []int64      `gorm:"column:rule_ids;type:varchar(1024)"`
 }
 
 type AlertMute struct {
@@ -246,8 +249,8 @@ type Configs struct {
 	Note string `gorm:"column:note;type:varchar(1024);default:'';comment:note"`
 	Cval string `gorm:"column:cval;type:text;comment:config value"`
 	//mysql tinyint//postgresql smallint
-	External  int64  `gorm:"column:external;type:bigint;default:0;comment:0 means built-in 1 means external"`
-	Encrypted int    `gorm:"column:encrypted;type:int;default:0;comment:0 means plaintext 1 means ciphertext"`
+	External  int    `gorm:"column:external;type:int;default:0;comment:0\\:built-in 1\\:external"`
+	Encrypted int    `gorm:"column:encrypted;type:int;default:0;comment:0\\:plaintext 1\\:ciphertext"`
 	CreateAt  int64  `gorm:"column:create_at;type:int;default:0;comment:create_at"`
 	CreateBy  string `gorm:"column:create_by;type:varchar(64);default:'';comment:cerate_by"`
 	UpdateAt  int64  `gorm:"column:update_at;type:int;default:0;comment:update_at"`