fleet-platform/db/migrations/20260601000020_normalize_assigned_city.sql

17 lines
617 B
MySQL
Raw Permalink Normal View History

-- migrate:up
--
-- Data hygiene: 1 vehicle had `assigned_city = 'Nairobi'` while the other
-- 54 had `'nairobi'`. Collapse to lower-case so the filter dropdown shows
-- a single canonical option. The projector doesn't set assigned_city (it
-- comes from manual edits / roster imports) so no other code change is
-- needed to prevent recurrence.
UPDATE domain.vehicles
SET assigned_city = trim(lower(assigned_city)),
updated_at = now()
WHERE assigned_city IS NOT NULL
AND assigned_city != trim(lower(assigned_city));
-- migrate:down
-- No-op: re-introducing inconsistent casing would be a regression.