-- Migration 003: scrape schedule config
SET search_path TO crawl;

CREATE TABLE IF NOT EXISTS scrape_schedule (
    id           SERIAL      PRIMARY KEY,
    enabled      BOOLEAN     NOT NULL DEFAULT FALSE,
    interval_days INT        NOT NULL DEFAULT 1,   -- 每隔多少天
    start_hour   SMALLINT    NOT NULL DEFAULT 2,   -- 每天几点开始（0-23）
    updated_at   TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

-- 只保留一行配置
INSERT INTO scrape_schedule (id, enabled, interval_days, start_hour)
VALUES (1, FALSE, 1, 2)
ON CONFLICT (id) DO NOTHING;
