1.5 KiB
1.5 KiB
Platform Vehicle Data Loader Refresh
Context
- Reintroduced the normalized
vehiclesschema (make/model/model_year/trim/engine + bridges) with a new migration underbackend/src/features/platform/migrations/001_create_vehicle_lookup_schema.sql. - Added
scripts/load_vehicle_data.py, a stand-alone Python loader that hydrates the schema fromdata/make-models/*.json. - Loader truncates lookup tables, seeds default transmissions (Automatic, Manual), and inserts deduplicated year → make → model → trim → engine combinations.
Follow-up Tasks (Backend API Team)
- Wire dropdown API to refreshed data
- Run
make migrate(ornpm run migrate:allinside backend container) to ensure the new schema exists. - Execute the loader (see command below) so Postgres has the latest lookup entries.
- Verify
VehicleDataRepositoryqueries and Redis caching logic continue to function against the reinstated tables.
- Run
- Add Makefile wrapper
- Create a
make load-vehicle-datatask that shells into the backend container, installspsycopgif needed, and invokespython3 scripts/load_vehicle_data.pywith the correct DB credentials and data directory.
- Create a
Loader Command Reference
PGPASSWORD=$(cat secrets/app/postgres-password.txt) \
python3 scripts/load_vehicle_data.py \
--db-host 127.0.0.1 \
--db-port 5432 \
--db-user postgres \
--db-name motovaultpro \
--data-dir data/make-models
Run the command from the repository root (outside of containers) while
mvp-postgresis up. Adjust host/port if executing inside a container.