- link to url, blog_categories to all-journal-categories, --map old=new on top; page entries dropped - entries of unknown types or stale registry references dropped with their subtree, one report line per dropped or remapped entry - ids, menu_id, parent_id, nest columns and sort_order kept; setval for both tables; --force, --dry-run, empty files copy nothing - scripts/winter-export-menus.sql and winter-export-entries.sql - TestMenuImportSmoke
26 lines
843 B
SQL
26 lines
843 B
SQL
-- Menus of a WinterCMS site with the Golem15.Menu plugin, one JSON object
|
|
-- per line: the --menus input of menu:import-winter.
|
|
--
|
|
-- mysql -N -B --raw <database> < winter-export-menus.sql > menus.jsonl
|
|
--
|
|
-- Read-only: it selects from the menus table and changes nothing.
|
|
-- JSON_OBJECT needs MySQL 5.7.8+ or MariaDB 10.2.3+.
|
|
--
|
|
-- Check the table name on the server before running:
|
|
-- SHOW TABLES LIKE '%menu_menus';
|
|
-- This file assumes golem15_menu_menus.
|
|
--
|
|
-- Export the entries with winter-export-entries.sql in the same run: the
|
|
-- entries refer to these ids, and the command keeps both.
|
|
SELECT JSON_OBJECT(
|
|
'id', m.id,
|
|
'name', m.name,
|
|
'code', m.code,
|
|
'is_active', m.is_active,
|
|
'css_class', m.css_class,
|
|
'created_at', m.created_at,
|
|
'updated_at', m.updated_at
|
|
)
|
|
FROM golem15_menu_menus m
|
|
ORDER BY m.id;
|