INSERT IGNORE INTO qipai_role_permissions (tenant_id, role_id, permission_id)
SELECT r.tenant_id, r.id, p.id
FROM qipai_roles r
INNER JOIN qipai_permissions p
  ON p.code IN ('profile.read', 'store.operation.read')
WHERE r.code = 'STAFF'
  AND r.status = 'ACTIVE'
  AND r.deleted_at IS NULL;

INSERT IGNORE INTO qipai_schema_migrations (version, name)
VALUES ('2026081001', 'm08c_staff_management_access');
