v1.5.1 增强程序稳定性
This commit is contained in:
@@ -116,6 +116,9 @@ var upgradeFuncs = []*upgradeVersion{
|
||||
{
|
||||
"1.4.9", upgradeV1_4_9,
|
||||
},
|
||||
{
|
||||
"1.5.1", upgradeV1_5_1,
|
||||
},
|
||||
}
|
||||
|
||||
// UpgradeSQLData 升级SQL数据
|
||||
@@ -1292,6 +1295,27 @@ func upgradeV1_4_9(db *dbs.DB) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// v1.5.1
|
||||
func upgradeV1_5_1(db *dbs.DB) error {
|
||||
// 补充 httpdnsClusterIds 字段(1.4.8 升级可能因版本号跳过未执行)
|
||||
_, err := db.Exec("ALTER TABLE `edgeUsers` ADD COLUMN `httpdnsClusterIds` text DEFAULT NULL COMMENT 'HTTPDNS关联集群ID列表'")
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), "Duplicate column") {
|
||||
// 字段已存在,忽略
|
||||
} else {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// 确保 HTTPDNS 相关表存在
|
||||
err = createHTTPDNSTables(db)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func createHTTPDNSTables(db *dbs.DB) error {
|
||||
sqls := []string{
|
||||
"CREATE TABLE IF NOT EXISTS `edgeHTTPDNSClusters` (`id` bigint unsigned NOT NULL AUTO_INCREMENT,`name` varchar(255) DEFAULT NULL,`isOn` tinyint unsigned DEFAULT '1',`isDefault` tinyint unsigned DEFAULT '0',`serviceDomain` varchar(255) DEFAULT NULL,`defaultTTL` int unsigned DEFAULT '30',`fallbackTimeoutMs` int unsigned DEFAULT '300',`installDir` varchar(255) DEFAULT '/root/edge-httpdns',`tlsPolicy` json DEFAULT NULL,`autoRemoteStart` tinyint unsigned DEFAULT '0',`accessLogIsOn` tinyint unsigned DEFAULT '0',`timeZone` varchar(128) NOT NULL DEFAULT '',`createdAt` bigint unsigned DEFAULT '0',`updatedAt` bigint unsigned DEFAULT '0',`state` tinyint unsigned DEFAULT '1',PRIMARY KEY (`id`),KEY `name` (`name`),KEY `isDefault` (`isDefault`),KEY `state` (`state`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='HTTPDNS集群配置表(默认TTL、回退超时、服务域名等)'",
|
||||
|
||||
Reference in New Issue
Block a user