-- Migration Doctor snapshot, SQL export: gadgets on dashboards with their module key and filter preference. -- Read-only: a single SELECT, no writes, no temporary tables. Output: one JSON object per line. -- Run (read-only) with the mysql client and save the output as dashboard-gadgets.jsonl: -- mysql --batch --raw --skip-column-names --default-character-set=utf8mb4 -h DBHOST -u READONLY_USER -p JIRADB < dashboard-gadgets.sql > export/dashboard-gadgets.jsonl -- Needs MySQL 5.7.8 or newer (JSON_OBJECT). -- Then pass the export directory to the snapshot script: --sql-export-dir export (bash) or -SqlExportDir export (PowerShell). SELECT JSON_OBJECT( 'gadgetId', pc.id, 'dashboardId', pc.portalpage, 'column', pc.column_number, 'row', pc.positionseq, 'moduleKey', pc.dashboard_module_complete_key, 'gadgetXml', pc.gadget_xml, 'filterPref', (SELECT MIN(gp.userprefvalue) FROM gadgetuserpreference gp WHERE gp.portletconfiguration = pc.id AND gp.userprefkey IN ('filterId', 'projectOrFilterId'))) FROM portletconfiguration pc ORDER BY pc.portalpage, pc.column_number, pc.positionseq, pc.id;