Description
Availability should be derived from historical request attempts. It should not be stored directly on the feed or returned in the standard feed response.
Proposed solution
CREATE TABLE gtfsfeedavailabilitycheck (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
feed_id VARCHAR(255) NOT NULL,
checked_at TIMESTAMPTZ NOT NULL DEFAULT now(),
request_url TEXT NOT NULL,
status_code INTEGER,
latency_ms DOUBLE PRECISION,
error_message TEXT,
error_type VARCHAR(255),
success BOOLEAN NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
CONSTRAINT gtfsfeedavailabilitycheck_feed_id_fkey
FOREIGN KEY (feed_id)
REFERENCES gtfsfeed(id)
ON DELETE CASCADE
);
CREATE INDEX idx_gtfsfeedavailabilitycheck_feed_checked_at
ON gtfsfeedavailabilitycheck (feed_id, checked_at DESC);
CREATE INDEX idx_gtfsfeedavailabilitycheck_checked_at
ON gtfsfeedavailabilitycheck (checked_at DESC);
CREATE INDEX idx_gtfsfeedavailabilitycheck_feed_success_checked_at
ON gtfsfeedavailabilitycheck (feed_id, success, checked_at DESC);
I would keep success even if it can be inferred from status_code, because it makes queries and chart aggregation easier.
Description
Availability should be derived from historical request attempts. It should not be stored directly on the feed or returned in the standard feed response.
Proposed solution
I would keep success even if it can be inferred from status_code, because it makes queries and chart aggregation easier.