{"train": {"columns": [[0, "id", "INT", 0, null, 1], [1, "train_number", "INT", 0, null, 0], [2, "name", "TEXT", 0, null, 0], [3, "origin", "TEXT", 0, null, 0], [4, "destination", "TEXT", 0, null, 0], [5, "time", "TEXT", 0, null, 0], [6, "interval", "TEXT", 0, null, 0]], "primary_keys": ["id"], "foreign_keys": [], "unique_constraints": [[[0, 0, "id"]]], "check_constraints": []}, "station": {"columns": [[0, "id", "INT", 0, null, 1], [1, "network_name", "TEXT", 0, null, 0], [2, "services", "TEXT", 0, null, 0], [3, "local_authority", "TEXT", 0, null, 0]], "primary_keys": ["id"], "foreign_keys": [], "unique_constraints": [[[0, 0, "id"]]], "check_constraints": []}, "route": {"columns": [[0, "train_id", "INT", 0, null, 1], [1, "station_id", "INT", 0, null, 2]], "primary_keys": ["train_id", "station_id"], "foreign_keys": [[0, 0, "station", "station_id", "id", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "train", "train_id", "id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "train_id"], [1, 1, "station_id"]]], "check_constraints": []}, "weekly_weather": {"columns": [[0, "station_id", "INT", 0, null, 1], [1, "day_of_week", "TEXT", 0, null, 2], [2, "high_temperature", "INT", 0, null, 0], [3, "low_temperature", "INT", 0, null, 0], [4, "precipitation", "REAL", 0, null, 0], [5, "wind_speed_mph", "INT", 0, null, 0]], "primary_keys": ["station_id", "day_of_week"], "foreign_keys": [[0, 0, "station", "station_id", "id", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "station_id"], [1, 1, "day_of_week"]]], "check_constraints": []}}
CREATE TABLE train (
    id INT   PRIMARY KEY,
    train_number INT,
    name TEXT,
    origin TEXT,
    destination TEXT,
    time TEXT,
    interval TEXT,
    UNIQUE (id)
);

CREATE TABLE station (
    id INT   PRIMARY KEY,
    network_name TEXT,
    services TEXT,
    local_authority TEXT,
    UNIQUE (id)
);

CREATE TABLE route (
    train_id INT   PRIMARY KEY,
    station_id INT   PRIMARY KEY,
    PRIMARY KEY (train_id, station_id),
    UNIQUE (train_id, station_id),
    FOREIGN KEY (station_id) REFERENCES station(id),
    FOREIGN KEY (train_id) REFERENCES train(id)
);

CREATE TABLE weekly_weather (
    station_id INT   PRIMARY KEY,
    day_of_week TEXT   PRIMARY KEY,
    high_temperature INT,
    low_temperature INT,
    precipitation REAL,
    wind_speed_mph INT,
    PRIMARY KEY (station_id, day_of_week),
    UNIQUE (station_id, day_of_week),
    FOREIGN KEY (station_id) REFERENCES station(id)
);