Rebuild Vehicle Database

Scans all archived and active work orders, extracts vehicle data, deduplicates, and upserts into the Vehicle entity linked to the correct customer.

How it works

1. Loads all work orders (archived + active) from the database.

2. Extracts vehicle info (make, model, year, plate, VIN) per customer.

3. Deduplicates using VIN → plate → make/model/year priority.

4. Creates missing vehicles and updates existing ones with any missing fields.

5. All vehicles are linked to their customer via customer_id.