fix(仪表盘): 修正分区迁移与范围测试

This commit is contained in:
yangjianbo
2026-01-11 19:01:15 +08:00
parent 4b66ee2f8f
commit 48613558d4
2 changed files with 5 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
-- usage_logs monthly partition bootstrap.
-- Only converts to partitioned table when usage_logs is empty.
-- Existing installations with data require a manual migration plan.
-- Only creates partitions when usage_logs is already partitioned.
-- Converting usage_logs to a partitioned table requires a manual migration plan.
DO $$
DECLARE
@@ -20,8 +20,8 @@ BEGIN
IF NOT is_partitioned THEN
SELECT EXISTS(SELECT 1 FROM usage_logs LIMIT 1) INTO has_data;
IF NOT has_data THEN
EXECUTE 'ALTER TABLE usage_logs PARTITION BY RANGE (created_at)';
is_partitioned := TRUE;
-- Automatic conversion is intentionally skipped; see manual migration plan.
RAISE NOTICE 'usage_logs is not partitioned; skip automatic partitioning';
END IF;
END IF;