Fix stale tasks capability seed in deploy_tasks() -- add reallocate, fix wording

deploy_tasks() had its own embedded copy of the capability seed (separate from
auth/src/db.js and tasks/seed-app.js), still on the old 4-cap/"phase 2" set.
It only worked on this deploy because auth's own seed (DO UPDATE) raced ahead
of it; a fresh install would have silently skipped the reallocate cap.
This commit is contained in:
jtricerolph 2026-09-17 08:16:52 +00:00
parent 8ffca5740d
commit 653178fcf0

View file

@ -2401,13 +2401,15 @@ ${build_out}"
INSERT INTO app_capabilities (app_id, slug, name, description, sort_order) INSERT INTO app_capabilities (app_id, slug, name, description, sort_order)
SELECT a.id, c.slug, c.name, c.description, c.sort_order SELECT a.id, c.slug, c.name, c.description, c.sort_order
FROM apps a, (VALUES FROM apps a, (VALUES
('use', 'Use Tasks', 'Create and manage your own lists and tasks', 1), ('use', 'Use Tasks', 'Create and manage your own lists and tasks', 1),
('assign', 'Assign Tasks', 'Assign tasks to other users (phase 2)', 2), ('assign', 'Assign Tasks', 'Hand off your own tasks to other users', 2),
('admin', 'Manage All', 'View and manage every user''s tasks (phase 2)', 3), ('reallocate', 'Reallocate Tasks', 'View every user''s board and move any task between people', 3),
('settings', 'Settings', 'Configure tasks app settings', 4) ('admin', 'Manage All', 'View and manage every field of every user''s tasks (not yet built)', 4),
('settings', 'Settings', 'Configure the shared status pipeline and categories', 5)
) AS c(slug, name, description, sort_order) ) AS c(slug, name, description, sort_order)
WHERE a.slug = 'tasks' WHERE a.slug = 'tasks'
ON CONFLICT (app_id, slug) DO NOTHING; ON CONFLICT (app_id, slug) DO UPDATE SET
name = EXCLUDED.name, description = EXCLUDED.description, sort_order = EXCLUDED.sort_order;
INSERT INTO role_capabilities (role_id, capability_id) INSERT INTO role_capabilities (role_id, capability_id)
SELECT r.id, ac.id FROM roles r SELECT r.id, ac.id FROM roles r
JOIN app_capabilities ac ON ac.app_id = (SELECT id FROM apps WHERE slug = 'tasks') JOIN app_capabilities ac ON ac.app_id = (SELECT id FROM apps WHERE slug = 'tasks')