2.7 KiB
Post-Migration Updates Required
This document outlines the remaining updates needed after migrating to the multi-household architecture.
✅ Completed Fixes
-
Column name corrections in
list.model.v2.js:- Fixed
item_image→custom_image - Fixed
image_mime_type→custom_image_mime_type - Fixed
hlh.list_id→hlh.household_list_id
- Fixed
-
SQL query fixes:
- Fixed ORDER BY with DISTINCT in
getSuggestions - Fixed
setBoughtto use boolean instead of quantity logic
- Fixed ORDER BY with DISTINCT in
-
Created migration:
add_notes_column.sqlfor missing notes column
🔧 Required Database Migration
Run this SQL on your PostgreSQL database:
-- From backend/migrations/add_notes_column.sql
ALTER TABLE household_lists
ADD COLUMN IF NOT EXISTS notes TEXT;
COMMENT ON COLUMN household_lists.notes IS 'Optional user notes/description for the item';
🧹 Optional Cleanup (Not Critical)
Legacy Files Still Present
These files reference the old grocery_list table but are not actively used by the frontend:
backend/models/list.model.js- Old modelbackend/controllers/lists.controller.js- Old controllerbackend/routes/list.routes.js- Old routes (still mounted at/list)
Recommendation: Can be safely removed once you confirm the new architecture is working, or kept as fallback.
Route Cleanup in app.js
The old /list route is still mounted in backend/app.js:
const listRoutes = require("./routes/list.routes");
app.use("/list", listRoutes); // ← Not used by frontend anymore
Recommendation: Comment out or remove once migration is confirmed successful.
✅ No Frontend Changes Needed
The frontend is already correctly calling the new household-scoped endpoints:
- All calls use
/households/:householdId/stores/:storeId/list/*pattern - No references to old
/list/*endpoints
🎯 Next Steps
- Run the notes column migration (required for notes feature to work)
- Test the application thoroughly:
- Add items with images
- Mark items as bought/unbought
- Update item quantities and notes
- Test suggestions/autocomplete
- Test recently bought items
- Remove legacy files (optional, once confirmed working)
📝 Architecture Notes
Current Structure:
- All list operations are scoped to
household_id + store_id - History tracking uses
household_list_historytable - Image storage uses
custom_imageandcustom_image_mime_typecolumns - Classifications use
household_item_classificationstable (per household+store)
Middleware Chain:
auth → householdAccess → storeAccess → controller
This ensures users can only access data for households they belong to and stores linked to those households.