feat(migrations): canonical nav schema + apps seed + menu-items template

Three SQL files for apps to copy into their own migrations directory:

- nav-schema.up.sql      — schema "nav" + enum menu_type + tables
                            menu_items, menu_role_requirements,
                            menu_permission_requirements,
                            menu_product_requirements, apps. Apply
                            verbatim; the kit owns it.
- nav-apps-seed.up.sql   — canonical cross-app browse-apps list,
                            idempotent INSERT … ON CONFLICT DO UPDATE.
                            Updates flow via kit version bumps; apps
                            re-apply to receive new entries.
- nav-menu-items-template.sql — TEMPLATE only. Each app copies once,
                            renames to its next migration number, and
                            edits the seed rows for its own sidebar/
                            topbar/subbar items.

Adoption pattern documented in the kit README.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Claude
2026-05-12 11:24:46 +02:00
parent 440f815df7
commit 960dfeba7c
3 changed files with 217 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
-- @gsc/web-kit nav.apps canonical seed (apply verbatim, never edit)
--
-- Replicated into every app's nav.apps table so the "browse apps" panel
-- shows the same canonical list everywhere. Updates flow via kit version
-- bumps: re-copy this file into each app's migrations directory and re-apply.
--
-- ON CONFLICT (key) DO UPDATE keeps the canonical list in sync — any local
-- edits to these rows will be overwritten on next apply. Add new apps by
-- editing this file in the kit and bumping the kit's minor version.
INSERT INTO nav.apps (key, name, description, url, icon_class, icon_url, icon_bg, sort_order, enabled)
VALUES
('gsc-crm', 'CRM', 'Customer relationship management', 'https://crm.gosec.internal', NULL, 'https://assets.gosec.cloud/logos/crm.svg', NULL, 10, TRUE),
('gsc-chronos', 'Chronos', 'Time tracking and timesheets', 'https://chronos.gosec.internal', NULL, 'https://assets.gosec.cloud/logos/chronos.svg', NULL, 20, TRUE),
('gsc-meet', 'GSC Meet', 'Video conferencing with AI features', '/apps/gsc-meet', NULL, '/images/demo/logos/1.svg', NULL, 30, TRUE),
('gsc-voice', 'Voice', 'PBX and telephony management', '/apps/gsc-voice', 'ph-phone', NULL, 'bg-primary-lt', 40, TRUE),
('gsc-ai-hub', 'AI Hub', 'AI models and services management', '/apps/gsc-ai-hub', NULL, '/images/demo/logos/2.svg', NULL, 50, TRUE),
('gsc-surveillance', 'Surveillance', 'Video surveillance and security', '/apps/surveillance', NULL, '/images/demo/logos/3.svg', NULL, 60, TRUE),
('gsc-archive', 'Archive', 'Email archiving and eDiscovery', '/apps/gsc-archive', 'ph-archive-box', NULL, 'bg-info-lt', 70, TRUE),
('gsc-dam', 'Digital Asset Manager', 'Media and asset management platform', '/apps/gsc-dam', NULL, '/images/demo/logos/4.svg', NULL, 80, TRUE)
ON CONFLICT (key) DO UPDATE
SET name = EXCLUDED.name,
description = EXCLUDED.description,
url = EXCLUDED.url,
icon_class = EXCLUDED.icon_class,
icon_url = EXCLUDED.icon_url,
icon_bg = EXCLUDED.icon_bg,
sort_order = EXCLUDED.sort_order,
enabled = EXCLUDED.enabled,
updated_at = NOW();