-- Seed de permissões RBAC para módulo Fiscal (MySQL)

-- Criar permissões se não existirem
INSERT IGNORE INTO permissions (name) VALUES
  ('fiscal.certs.read'),
  ('fiscal.certs.manage');

-- Vincular permissões ao papel 'admin'
SET @role_id = (SELECT id FROM roles WHERE name = 'admin' LIMIT 1);
SET @perm_read = (SELECT id FROM permissions WHERE name = 'fiscal.certs.read' LIMIT 1);
SET @perm_manage = (SELECT id FROM permissions WHERE name = 'fiscal.certs.manage' LIMIT 1);

INSERT IGNORE INTO role_permissions (role_id, permission_id) VALUES
  (@role_id, @perm_read),
  (@role_id, @perm_manage);