-- Gold Jewellery Software - Data Seeding & Production Reset
-- Migration 006: a dedicated permission for these two tools. Deliberately
-- separate from settings.manage — a reset button is a different class of
-- risk than editing the shop name, and should be grantable (or not)
-- independently of general Settings access.
USE gold_jewellery;

INSERT INTO permissions (slug, description) VALUES
 ('system.manage', 'Seed demo data and perform a full production data reset')
ON DUPLICATE KEY UPDATE description = VALUES(description);

INSERT INTO role_permissions (role_id, permission_id)
SELECT r.id, p.id FROM roles r CROSS JOIN permissions p
WHERE r.name = 'ADMIN' AND p.slug = 'system.manage'
ON DUPLICATE KEY UPDATE role_id = role_id;
