-- migrate:up

ALTER TABLE state.live_positions
    ADD COLUMN IF NOT EXISTS mc_type            text,
    ADD COLUMN IF NOT EXISTS current_mileage_km numeric,
    ADD COLUMN IF NOT EXISTS gps_signal         int,
    ADD COLUMN IF NOT EXISTS satellites         int,
    ADD COLUMN IF NOT EXISTS device_name        text,
    ADD COLUMN IF NOT EXISTS pos_type           text;

ALTER TABLE state.position_history
    ADD COLUMN IF NOT EXISTS mc_type            text,
    ADD COLUMN IF NOT EXISTS current_mileage_km numeric,
    ADD COLUMN IF NOT EXISTS gps_signal         int,
    ADD COLUMN IF NOT EXISTS pos_type           text;

-- migrate:down

ALTER TABLE state.live_positions
    DROP COLUMN IF EXISTS mc_type,
    DROP COLUMN IF EXISTS current_mileage_km,
    DROP COLUMN IF EXISTS gps_signal,
    DROP COLUMN IF EXISTS satellites,
    DROP COLUMN IF EXISTS device_name,
    DROP COLUMN IF EXISTS pos_type;

ALTER TABLE state.position_history
    DROP COLUMN IF EXISTS mc_type,
    DROP COLUMN IF EXISTS current_mileage_km,
    DROP COLUMN IF EXISTS gps_signal,
    DROP COLUMN IF EXISTS pos_type;
