- 6 config blocks (DB/Redis/Channel/Refresh/Partition/Extension with 4 EnableXxx=false) - 14 Prometheus metric declarations - self-impl healthz (/healthz + /metrics) — bypasses pkg/health to keep /metrics - main.go startup: logger → config → DB → Redis → healthz HTTP :21009 - 10 SQL migrations: events partitioned + 4 MV + 3 pre-agg + refresh_log + 7-day initial 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
22 lines
618 B
SQL
22 lines
618 B
SQL
-- statistic 服务 events 表初始 7 天分区
|
||
-- 创建时间: 2026-06-08
|
||
-- 关联: spec §3.3 分区管理
|
||
-- 说明: 手动运行一次或由 partitioner worker 自动运行
|
||
-- (worker/partitioner.go 实现,自动调度见 plan Task 8)
|
||
|
||
DO $$
|
||
DECLARE
|
||
i INT;
|
||
d DATE;
|
||
n DATE;
|
||
BEGIN
|
||
FOR i IN 0..6 LOOP
|
||
d := CURRENT_DATE + i;
|
||
n := d + 1;
|
||
EXECUTE format(
|
||
'CREATE TABLE IF NOT EXISTS statistic.events_%s PARTITION OF statistic.events FOR VALUES FROM (%L) TO (%L)',
|
||
to_char(d, 'YYYY_MM_DD'), d::text, n::text
|
||
);
|
||
END LOOP;
|
||
END $$;
|