diff --git a/db/migrations/20260601000019_fn_vehicle_trips.sql b/db/migrations/20260601000019_fn_vehicle_trips.sql index 34b1c25..2a7eac9 100644 --- a/db/migrations/20260601000019_fn_vehicle_trips.sql +++ b/db/migrations/20260601000019_fn_vehicle_trips.sql @@ -33,8 +33,13 @@ -- Falls back to movement-only segmentation (has_acc_data=false in the -- response) when every position for the day has acc_state IS NULL. +-- Drop any prior signature; the function identity is (name + arg types), +-- so a CREATE OR REPLACE with a different arg type would create a sibling. +DROP FUNCTION IF EXISTS serve.fn_vehicle_trips(integer, date); +DROP FUNCTION IF EXISTS serve.fn_vehicle_trips(bigint, date); + CREATE OR REPLACE FUNCTION serve.fn_vehicle_trips( - p_vehicle_id integer, + p_vehicle_id bigint, p_date_eat date ) RETURNS jsonb LANGUAGE plpgsql STABLE @@ -385,4 +390,5 @@ $fn$; -- migrate:down +DROP FUNCTION IF EXISTS serve.fn_vehicle_trips(bigint, date); DROP FUNCTION IF EXISTS serve.fn_vehicle_trips(integer, date);