-- Add fitness_expires column to vehicles and update Vehicle Registration form
ALTER TABLE vehicles
    ADD COLUMN IF NOT EXISTS fitness_expires DATE DEFAULT NULL;

INSERT INTO form_elements (
    form_id, label, field_name, data_column, type_id, order_index)
SELECT 29, 'fitness_expires', 'fitness_expires', 'fitness_expires',
       (SELECT id FROM element_types WHERE name = 'date' LIMIT 1), 9
WHERE NOT EXISTS (
    SELECT 1 FROM form_elements WHERE form_id = 29 AND field_name = 'fitness_expires'
);
