File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 109109 <include file =" changes/feat_task_execution_log.sql" relativeToChangelogFile =" true" />
110110 <!-- Add MD5 hash column to GTFSDataset table. -->
111111 <include file =" changes/feat_1657.sql" relativeToChangelogFile =" true" />
112+ <!-- Add table to store GTFS feed availability check results. -->
113+ <include file =" changes/feat_1700.sql" relativeToChangelogFile =" true" />
112114 <!-- Keep this at the very end to ensure all table and schema changes
113115 are applied before materialized views are (re)created. -->
114116 <include file =" materialized_views/materialized_views.xml" relativeToChangelogFile =" true" />
Original file line number Diff line number Diff line change 1+ -- Add table to store GTFS feed availability check results (issue #1700).
2+ -- Supports feed availability analysis as described in epic #1699.
3+ CREATE TYPE availability_check_request_type AS ENUM (
4+ ' http_head' ,
5+ ' http_get'
6+ );
7+
8+ CREATE TABLE IF NOT EXISTS gtfs_feed_availability_check (
9+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
10+
11+ feed_id VARCHAR (255 ) NOT NULL ,
12+ checked_at TIMESTAMPTZ NOT NULL DEFAULT now(),
13+
14+ request_url TEXT NOT NULL ,
15+ request_type availability_check_request_type NOT NULL ,
16+ status_code INTEGER ,
17+ latency_ms INTEGER ,
18+
19+ error_message TEXT ,
20+ error_type VARCHAR (255 ),
21+
22+ success BOOLEAN NOT NULL ,
23+
24+ created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
25+
26+ CONSTRAINT gtfs_feed_availability_check_feed_id_fkey
27+ FOREIGN KEY (feed_id)
28+ REFERENCES gtfsfeed(id)
29+ ON DELETE CASCADE
30+ );
31+
32+ CREATE INDEX IF NOT EXISTS idx_gtfs_feed_availability_check_feed_checked_at
33+ ON gtfs_feed_availability_check (feed_id, checked_at DESC );
34+
35+ CREATE INDEX IF NOT EXISTS idx_gtfs_feed_availability_check_checked_at
36+ ON gtfs_feed_availability_check (checked_at DESC );
37+
38+ CREATE INDEX IF NOT EXISTS idx_gtfs_feed_availability_check_feed_success_checked_at
39+ ON gtfs_feed_availability_check (feed_id, success, checked_at DESC );
You can’t perform that action at this time.
0 commit comments