mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-07 16:16:37 +08:00
fix(log): hard-set log retention days default to 30, drop legacy inheritance
log_retention_days_* 迁移不再继承旧键 database_auto_cleanup_retention_days 的值,统一默认 30 天。此前若旧键残留异常小值(如 2 天)会被静默带入, 导致升级后首次垃圾清理把大部分日志直接删掉。PG/SQLite 双方言同步修改, 文档默认值 90 -> 30。
This commit is contained in:
+2
-1
@@ -1,7 +1,8 @@
|
||||
-- +goose Up
|
||||
-- 日志保留天数配置(business),替换旧的 database_auto_cleanup_* 键。
|
||||
-- 默认统一 30 天:不继承旧键值,避免旧配置被静默带入导致日志被过度清理。
|
||||
INSERT INTO w_system_configs (key, value, type, visibility, description, created_at, updated_at)
|
||||
SELECT k, COALESCE((SELECT value FROM w_system_configs WHERE key = 'database_auto_cleanup_retention_days'), '90'), 'business', 0, descr, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP
|
||||
SELECT k, '30', 'business', 0, descr, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP
|
||||
FROM (VALUES
|
||||
('log_retention_days_postgres', 'PostgreSQL 日志保留天数(访问日志与可观测统一)'),
|
||||
('log_retention_days_sqlite', 'SQLite 日志保留天数'),
|
||||
|
||||
+4
-3
@@ -1,11 +1,12 @@
|
||||
-- +goose Up
|
||||
-- 日志保留天数配置(business),替换旧的 database_auto_cleanup_* 键。
|
||||
-- 默认统一 30 天:不继承旧键值,避免旧配置被静默带入导致日志被过度清理。
|
||||
INSERT OR IGNORE INTO w_system_configs (key, value, type, visibility, description, created_at, updated_at)
|
||||
SELECT 'log_retention_days_postgres', COALESCE((SELECT value FROM w_system_configs WHERE key = 'database_auto_cleanup_retention_days'), '90'), 'business', 0, 'PostgreSQL 日志保留天数(访问日志与可观测统一)', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP
|
||||
SELECT 'log_retention_days_postgres', '30', 'business', 0, 'PostgreSQL 日志保留天数(访问日志与可观测统一)', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP
|
||||
UNION ALL
|
||||
SELECT 'log_retention_days_sqlite', COALESCE((SELECT value FROM w_system_configs WHERE key = 'database_auto_cleanup_retention_days'), '90'), 'business', 0, 'SQLite 日志保留天数', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP
|
||||
SELECT 'log_retention_days_sqlite', '30', 'business', 0, 'SQLite 日志保留天数', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP
|
||||
UNION ALL
|
||||
SELECT 'log_retention_days_clickhouse', COALESCE((SELECT value FROM w_system_configs WHERE key = 'database_auto_cleanup_retention_days'), '90'), 'business', 0, 'ClickHouse 日志保留天数', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP;
|
||||
SELECT 'log_retention_days_clickhouse', '30', 'business', 0, 'ClickHouse 日志保留天数', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP;
|
||||
|
||||
DELETE FROM w_system_configs WHERE key IN ('database_auto_cleanup_enabled', 'database_auto_cleanup_retention_days');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user