feat(fase-5.10.0): drop shopping_items.unit column
The unit field had no edit path under the redesign (only name + qty
remain in the row; the double-tap overlay is name-only). Users can encode
the unit inside the name when it matters — e.g. "Milk 1L", "Eggs 1 doz".
Changes
supabase/migrations/011_drop_shopping_items_unit.sql — DROP COLUMN
supabase/seed.sql — unit values folded into names where relevant
supabase/tests/002_item_frequency_trigger.sql — remove unit from INSERT
packages/types — remove unit from ShoppingItem Row/Insert/Update
apps/web/src/lib/stores/lists.ts — addItem/updateItem signatures
apps/web/src/routes/(app)/lists/[id]/+page.svelte — purge newUnit /
editUnit state + inputs + display
apps/web/src/routes/(app)/lists/[id]/session/+page.svelte — simplify
quantity-only render
apps/web/messages/{en,es}.json — remove list_unit_label
Verification
just test-db → 34 pgTAP green
just test-integration → 140 + 2 skipped
just test-unit → 11 green
just test-e2e → 39 + 2 skipped
The generated search tsvector on shopping_items.search already indexes
only `name`, so full-text search coverage is unchanged.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
7
supabase/migrations/011_drop_shopping_items_unit.sql
Normal file
7
supabase/migrations/011_drop_shopping_items_unit.sql
Normal file
@@ -0,0 +1,7 @@
|
||||
-- Migration 011: drop shopping_items.unit
|
||||
--
|
||||
-- The UI no longer exposes a unit field. Users encode the unit inside the item
|
||||
-- name when relevant (e.g. "Milk 1L", "Eggs 1 doz"). The generated `search`
|
||||
-- tsvector already indexes only `name`, so search coverage is unchanged.
|
||||
|
||||
ALTER TABLE public.shopping_items DROP COLUMN unit;
|
||||
@@ -103,13 +103,13 @@ BEGIN
|
||||
VALUES ('bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb', 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa', 'Weekly shop', 'active', '11111111-1111-1111-1111-111111111111')
|
||||
ON CONFLICT (id) DO NOTHING;
|
||||
|
||||
INSERT INTO public.shopping_items (list_id, name, quantity, unit, sort_order, created_by)
|
||||
INSERT INTO public.shopping_items (list_id, name, quantity, sort_order, created_by)
|
||||
VALUES
|
||||
('bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb', 'Milk', 2, 'L', 1, '11111111-1111-1111-1111-111111111111'),
|
||||
('bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb', 'Bread', 1, NULL, 2, '22222222-2222-2222-2222-222222222222'),
|
||||
('bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb', 'Eggs', 1, 'doz', 3, '11111111-1111-1111-1111-111111111111'),
|
||||
('bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb', 'Coffee', 1, NULL, 4, '33333333-3333-3333-3333-333333333333'),
|
||||
('bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb', 'Apples', 6, NULL, 5, '22222222-2222-2222-2222-222222222222')
|
||||
('bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb', 'Milk 1L', 2, 1, '11111111-1111-1111-1111-111111111111'),
|
||||
('bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb', 'Bread', 1, 2, '22222222-2222-2222-2222-222222222222'),
|
||||
('bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb', 'Eggs 1 doz', 1, 3, '11111111-1111-1111-1111-111111111111'),
|
||||
('bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb', 'Coffee', 1, 4, '33333333-3333-3333-3333-333333333333'),
|
||||
('bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb', 'Apples', 6, 5, '22222222-2222-2222-2222-222222222222')
|
||||
ON CONFLICT DO NOTHING;
|
||||
END IF;
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ VALUES (
|
||||
) ON CONFLICT (id) DO NOTHING;
|
||||
|
||||
-- D-13: Inserting an item creates a new frequency row (normalized name)
|
||||
INSERT INTO public.shopping_items (list_id, name, quantity, unit, sort_order, created_by)
|
||||
VALUES ('cccccccc-cccc-cccc-cccc-cccccccccccc', ' Butter ', 1, NULL, 50, '11111111-1111-1111-1111-111111111111');
|
||||
INSERT INTO public.shopping_items (list_id, name, quantity, sort_order, created_by)
|
||||
VALUES ('cccccccc-cccc-cccc-cccc-cccccccccccc', ' Butter ', 1, 50, '11111111-1111-1111-1111-111111111111');
|
||||
|
||||
SELECT ok(
|
||||
EXISTS (
|
||||
|
||||
Reference in New Issue
Block a user