Files
breadcrumb-the-shire/modules/notifications/db/updates/2026-03-19-notifications-permission-defaults.sql

14 lines
507 B
SQL

INSERT INTO `permissions` (`key`, `description`, `active`, `is_system`)
VALUES ('notifications.view', 'Can view and manage own notifications', 1, 1)
ON DUPLICATE KEY UPDATE
`description` = VALUES(`description`),
`active` = VALUES(`active`),
`is_system` = VALUES(`is_system`);
INSERT INTO `role_permissions` (`role_id`, `permission_id`, `created`)
SELECT r.id, p.id, NOW()
FROM roles r
JOIN permissions p ON p.`key` = 'notifications.view'
WHERE r.active = 1
ON DUPLICATE KEY UPDATE role_id = role_id;