Public Access
fix(migration): simplify aisle migration + add persistent backup script
- Drop the empty batch_alter_table block and the meaningless set_config call from migration 0015. Temp tables still persist for the migration's session (Alembic's transactional_ddl). - New backend/scripts/persist_aisle_backup.sql creates public.ingredient_aisle_backup_0015 and public.grocery_item_aisle_backup_0015 permanent tables for operators who want a recoverable record beyond the migration. - Update Review/sprint2-verification.md, Review/ui-nielsen-audit.md and fix-ui-audit.md with the correct container-based deploy steps: docker compose exec db psql -U mealplanner -d mealplanner -f /dev/stdin < ...sql. Host psql is not available on the deployment host; the db runs inside the container.
This commit is contained in:
@@ -18,24 +18,43 @@
|
||||
| `frontend/src/pages/ShoppingList.tsx` | B9: `AISLE_LABEL` map + `aisleDisplay()`; S3.3: 3-col grid on all viewports with compact mobile sizing. |
|
||||
| `frontend/src/pages/Recipes.tsx` | B11: `applied`/`pending` filter state, Apply/Reset buttons, active-count chip on Filters button, `role="region"`. |
|
||||
|
||||
## How to verify on the deployment host
|
||||
## How to deploy on the remote host (the database is in a container)
|
||||
|
||||
The dev DB runs inside `mealplanner-db-1`. No host `psql` is required. All commands run via `docker compose exec` from the project root.
|
||||
|
||||
```bash
|
||||
cd /path/to/MealPlanner
|
||||
cd ~/MealPlanner
|
||||
git pull
|
||||
|
||||
# 1. Backend migration (one-off, dry-run first)
|
||||
psql "$DATABASE_URL" -f backend/scripts/dry_run_aisle_migration.sql
|
||||
docker compose exec backend alembic upgrade head
|
||||
# 1. (Optional but strongly recommended) Take a persistent backup of
|
||||
# aisle values BEFORE the migration runs. This stays in the DB
|
||||
# even after the migration session ends.
|
||||
docker compose exec -T db psql -U mealplanner -d mealplanner \
|
||||
-f /dev/stdin < backend/scripts/persist_aisle_backup.sql
|
||||
|
||||
# 2. Frontend rebuild + restart
|
||||
# 2. Dry-run preview — counts rows that would change, no writes.
|
||||
docker compose exec -T db psql -U mealplanner -d mealplanner \
|
||||
-f /dev/stdin < backend/scripts/dry_run_aisle_migration.sql
|
||||
# Expected output (example):
|
||||
# tbl | rows_to_change | distinct_old_values
|
||||
# --------------+----------------+---------------------
|
||||
# grocery_item | 10539 | 16
|
||||
# ingredient | 10657 | 27
|
||||
|
||||
# 3. If the dry-run row counts look sane, apply the migration:
|
||||
docker compose exec backend alembic upgrade head
|
||||
# Expected: "Running upgrade 0014 -> 0015, normalize_pantry_aisles"
|
||||
|
||||
# 4. Frontend rebuild + restart (Sprint 2 UI changes are already merged).
|
||||
docker compose -f docker-compose.yml up -d --build frontend
|
||||
|
||||
# 3. Smoke-check the live site
|
||||
# 5. Smoke-check the live site
|
||||
curl -s -o /dev/null -w "%{http_code}\n" http://100.108.208.56:8082/
|
||||
# Expect: 200
|
||||
```
|
||||
|
||||
If the dry-run row count is high (>1k on ingredient) and you want to inspect what would change before applying, uncomment the second query at the bottom of `dry_run_aisle_migration.sql` and re-run.
|
||||
|
||||
## Manual smoke checks
|
||||
|
||||
- `/` (mobile 390 px): Generate button visible on every empty slot; new meal title clamps to 2 lines without `B..`.
|
||||
|
||||
Reference in New Issue
Block a user