From c0b6af4383c88a8c22f468591d6e743a18abd45a Mon Sep 17 00:00:00 2001 From: jtricerolph Date: Sun, 5 Jul 2026 09:19:49 +0000 Subject: [PATCH] Add booking_scrape_log table to schema.sql Missing from initial schema; used by competitor rates scraper and cleanup_stale_batches on startup. Co-Authored-By: Claude Sonnet 4.6 --- backend/schema.sql | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/backend/schema.sql b/backend/schema.sql index 3d08d2e..751990b 100644 --- a/backend/schema.sql +++ b/backend/schema.sql @@ -253,6 +253,26 @@ CREATE TABLE IF NOT EXISTS newbook_occupancy_report_data ( CREATE INDEX IF NOT EXISTS idx_occupancy_report_data_date ON newbook_occupancy_report_data(date); +-- ============================================ +-- BOOKING SCRAPE LOG (competitor rate scraper batches) +-- ============================================ + +CREATE TABLE IF NOT EXISTS booking_scrape_log ( + batch_id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + scrape_type VARCHAR(50) NOT NULL, + started_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), + completed_at TIMESTAMPTZ, + status VARCHAR(20) NOT NULL DEFAULT 'running', + hotels_found INTEGER DEFAULT 0, + rates_scraped INTEGER DEFAULT 0, + dates_queued INTEGER DEFAULT 0, + error_message TEXT, + blocked_at TIMESTAMPTZ, + resume_after TIMESTAMPTZ +); + +CREATE INDEX IF NOT EXISTS idx_booking_scrape_log_started ON booking_scrape_log(started_at DESC); + -- ============================================ -- SYNC LOGGING -- ============================================