Adds enabled_languages on restaurants and translations JSONB on menu categories/items. New /restaurants/:id/languages endpoints bulk-translate the full menu via Gemini/GPT-4o-mini (reusing the ai-scanner dual-provider pattern) when a language is enabled. New categories/items are auto- translated in the background into any already-enabled languages. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
16 lines
756 B
SQL
16 lines
756 B
SQL
-- Multi-language menu support (PRD §13). Translations are stored inline as
|
|
-- JSONB keyed by language code rather than a separate table — menu content
|
|
-- is small and always read/written as a whole category+items tree, so a
|
|
-- join-free read matches how the public page already fetches it.
|
|
|
|
alter table restaurants
|
|
add column if not exists enabled_languages text[] not null default array['tr'];
|
|
|
|
alter table menu_categories
|
|
add column if not exists translations jsonb not null default '{}'::jsonb;
|
|
-- shape: { "en": { "name": "...", "description": "..." }, "de": {...} }
|
|
|
|
alter table menu_items
|
|
add column if not exists translations jsonb not null default '{}'::jsonb;
|
|
-- shape: { "en": { "name": "...", "description": "..." }, "de": {...} }
|