ALTER TABLE calculation_job
    ADD COLUMN retries  INT         NOT NULL DEFAULT 0,
    ADD COLUMN priority VARCHAR(10) NOT NULL DEFAULT 'MEDIUM'
        CHECK (priority IN ('LOW', 'MEDIUM', 'HIGH'));

ALTER TABLE calculation_job
    ADD INDEX idx_priority (priority);

ALTER TABLE distance_matrix
    ADD COLUMN retries INT NOT NULL DEFAULT 0,
    DROP CONSTRAINT chk_distance_matrix_state,
    ADD CONSTRAINT chk_distance_matrix_state CHECK (`state` IN ('VALID', 'STALE', 'EXCEPTION'));


ALTER TABLE premise_destination
    ADD COLUMN distance_d2d DECIMAL(15, 2) DEFAULT NULL COMMENT 'travel distance between the two nodes in meters';

ALTER TABLE premise_route_section
    ADD COLUMN distance DECIMAL(15, 2) DEFAULT NULL COMMENT 'travel distance between the two nodes in meters';

