fix: fn_vehicle_trips takes bigint (domain.vehicles.vehicle_id is bigserial)
Some checks are pending
build / lint-test (push) Waiting to run
build / build-push (push) Blocked by required conditions

PG function overloading is type-strict: integer→bigint isn't implicit. The
prior signature (integer, date) didn't match callers passing vehicle_id
directly. Also prepends a DROP for the integer-signature in case the
previous migration ran and left a now-orphan function around.
This commit is contained in:
kianiadee 2026-05-27 14:36:45 +03:00
parent 9393491869
commit 0265477f46

View file

@ -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);