24 lines
1.4 KiB
SQL
24 lines
1.4 KiB
SQL
-- Migration: Create transfer_rules table for MCT (Minimum Connection Time) values
|
|
-- This table stores minimum connection time rules based on transfer context:
|
|
-- - airport_internal/through: 30 min (within same airport, through transfer)
|
|
-- - airport_internal/separate: 60 min (within same airport, separate transfers)
|
|
-- - station_internal: 30 min (between stations in same city)
|
|
-- - airport_to_city/small: 60 min (airport to small city)
|
|
-- - airport_to_city/million_plus: 90 min (airport to million+ city)
|
|
|
|
CREATE TABLE IF NOT EXISTS transfer_rules (
|
|
id SERIAL PRIMARY KEY,
|
|
rule_key VARCHAR(50) NOT NULL UNIQUE,
|
|
min_transfer_time_minutes INTEGER NOT NULL,
|
|
description TEXT,
|
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
);
|
|
|
|
-- Insert default MCT values
|
|
INSERT INTO transfer_rules (rule_key, min_transfer_time_minutes, description) VALUES
|
|
('airport_internal_through', 30, 'Minimum transfer time for internal connections at the same airport (through transfer)'),
|
|
('airport_internal_separate', 60, 'Minimum transfer time for internal connections at the same airport (separate transfers)'),
|
|
('station_internal', 30, 'Minimum transfer time between stations in the same city'),
|
|
('airport_to_city_small', 60, 'Minimum transfer time from airport to small city'),
|
|
('airport_to_city_million_plus', 90, 'Minimum transfer time from airport to million-plus city'); |