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:
@@ -0,0 +1,24 @@
|
||||
-- Persist a permanent backup of aisle values BEFORE running migration 0015.
|
||||
-- Run via Docker (no host psql required):
|
||||
--
|
||||
-- docker compose exec db psql -U mealplanner -d mealplanner \
|
||||
-- -f /dev/stdin < backend/scripts/persist_aisle_backup.sql
|
||||
--
|
||||
-- Creates two permanent backup tables in the public schema. They are NOT
|
||||
-- auto-dropped; you can DROP them manually after you confirm the migration
|
||||
-- is correct:
|
||||
--
|
||||
-- DROP TABLE public.ingredient_aisle_backup_0015;
|
||||
-- DROP TABLE public.grocery_item_aisle_backup_0015;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS public.ingredient_aisle_backup_0015 AS
|
||||
SELECT id, aisle, created_at FROM public.ingredient WHERE aisle IS NOT NULL;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS public.grocery_item_aisle_backup_0015 AS
|
||||
SELECT id, aisle FROM public.grocery_item WHERE aisle IS NOT NULL;
|
||||
|
||||
SELECT 'ingredient backup' AS table_name, COUNT(*) AS rows_backed_up
|
||||
FROM public.ingredient_aisle_backup_0015
|
||||
UNION ALL
|
||||
SELECT 'grocery_item backup' AS table_name, COUNT(*) AS rows_backed_up
|
||||
FROM public.grocery_item_aisle_backup_0015;
|
||||
Reference in New Issue
Block a user