auto_trade_sys/backend/fix_config_category.sql
薇薇安 6fe9cea33d a
2026-01-14 14:17:25 +08:00

41 lines
1.5 KiB
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- 修复配置分类的SQL脚本
-- 1. 确保 TOP_N_SYMBOLS 和 MAX_SCAN_SYMBOLS 都在 'scan' 分类下
-- 2. 删除已废弃的 USE_UNICORN_WEBSOCKET 配置项
USE auto_trade_sys;
-- 更新 TOP_N_SYMBOLS 分类为 scan如果当前不是
UPDATE trading_config
SET category = 'scan'
WHERE config_key = 'TOP_N_SYMBOLS' AND category != 'scan';
-- 更新 MAX_SCAN_SYMBOLS 分类为 scan如果当前不是
UPDATE trading_config
SET category = 'scan'
WHERE config_key = 'MAX_SCAN_SYMBOLS' AND category != 'scan';
-- 如果 MAX_SCAN_SYMBOLS 不存在,插入它
INSERT INTO trading_config (config_key, config_value, config_type, category, description)
VALUES ('MAX_SCAN_SYMBOLS', '500', 'number', 'scan', '扫描的最大交易对数量0表示扫描所有建议100-500')
ON DUPLICATE KEY UPDATE
category = 'scan',
description = '扫描的最大交易对数量0表示扫描所有建议100-500';
-- 删除已废弃的 USE_UNICORN_WEBSOCKET 配置项Unicorn WebSocket已移除
DELETE FROM trading_config WHERE config_key = 'USE_UNICORN_WEBSOCKET';
-- 验证结果
SELECT config_key, config_value, category, description
FROM trading_config
WHERE config_key IN ('TOP_N_SYMBOLS', 'MAX_SCAN_SYMBOLS')
ORDER BY config_key;
-- 确认 USE_UNICORN_WEBSOCKET 已删除
SELECT
CASE
WHEN COUNT(*) = 0 THEN '✓ USE_UNICORN_WEBSOCKET 已删除(正确)'
ELSE CONCAT('⚠ 警告USE_UNICORN_WEBSOCKET 仍存在,数量:', COUNT(*))
END as status
FROM trading_config
WHERE config_key = 'USE_UNICORN_WEBSOCKET';