修复数据库无法保存的BUG
This commit is contained in:
@@ -566,6 +566,7 @@ app.post('/api/setup/init', ensureSetupAccess, async (req, res) => {
|
||||
show_server_ip TINYINT(1) DEFAULT 0,
|
||||
ip_metric_name VARCHAR(100) DEFAULT NULL,
|
||||
ip_label_name VARCHAR(100) DEFAULT 'address',
|
||||
custom_metrics JSON DEFAULT NULL,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
|
||||
`);
|
||||
@@ -583,6 +584,7 @@ app.post('/api/setup/init', ensureSetupAccess, async (req, res) => {
|
||||
await connection.query("ALTER TABLE site_settings ADD COLUMN IF NOT EXISTS show_server_ip TINYINT(1) DEFAULT 0 AFTER network_data_sources");
|
||||
await connection.query("ALTER TABLE site_settings ADD COLUMN IF NOT EXISTS ip_metric_name VARCHAR(100) DEFAULT NULL AFTER show_server_ip");
|
||||
await connection.query("ALTER TABLE site_settings ADD COLUMN IF NOT EXISTS ip_label_name VARCHAR(100) DEFAULT 'address' AFTER ip_metric_name");
|
||||
await connection.query("ALTER TABLE site_settings ADD COLUMN IF NOT EXISTS custom_metrics JSON DEFAULT NULL AFTER ip_label_name");
|
||||
await connection.query(`
|
||||
CREATE TABLE IF NOT EXISTS latency_routes (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
@@ -951,8 +953,9 @@ app.post('/api/settings', requireAuth, async (req, res) => {
|
||||
id, page_name, show_page_name, title, logo_url, logo_url_dark, favicon_url,
|
||||
default_theme, show_95_bandwidth, p95_type, require_login_for_server_details,
|
||||
blackbox_source_id, latency_source, latency_dest, latency_target,
|
||||
icp_filing, ps_filing, network_data_sources, show_server_ip, ip_metric_name, ip_label_name
|
||||
) VALUES (1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
icp_filing, ps_filing, network_data_sources, show_server_ip, ip_metric_name, ip_label_name,
|
||||
custom_metrics
|
||||
) VALUES (1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
page_name = VALUES(page_name),
|
||||
show_page_name = VALUES(show_page_name),
|
||||
@@ -973,13 +976,14 @@ app.post('/api/settings', requireAuth, async (req, res) => {
|
||||
network_data_sources = VALUES(network_data_sources),
|
||||
show_server_ip = VALUES(show_server_ip),
|
||||
ip_metric_name = VALUES(ip_metric_name),
|
||||
ip_label_name = VALUES(ip_label_name)`,
|
||||
ip_label_name = VALUES(ip_label_name),
|
||||
custom_metrics = VALUES(custom_metrics)`,
|
||||
[
|
||||
settings.page_name, settings.show_page_name, settings.title, settings.logo_url, settings.logo_url_dark, settings.favicon_url,
|
||||
settings.default_theme, settings.show_95_bandwidth, settings.p95_type, settings.require_login_for_server_details,
|
||||
settings.blackbox_source_id, settings.latency_source, settings.latency_dest, settings.latency_target,
|
||||
settings.icp_filing, settings.ps_filing, settings.network_data_sources, settings.show_server_ip,
|
||||
settings.ip_metric_name, settings.ip_label_name
|
||||
settings.ip_metric_name, settings.ip_label_name, settings.custom_metrics
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user