diff --git a/classes/migration/upgrade/v3_5_0/I10511_RemoveSeriesMenuItems.php b/classes/migration/upgrade/v3_5_0/I10511_RemoveSeriesMenuItems.php new file mode 100644 index 0000000000..6760218917 --- /dev/null +++ b/classes/migration/upgrade/v3_5_0/I10511_RemoveSeriesMenuItems.php @@ -0,0 +1,54 @@ +where('type', 'NMI_TYPE_SERIES') + ->whereNotIn('path', function (Builder $query) { + $query->select('series_id')->from('series'); + })->pluck('navigation_menu_item_id'); + + DB::table('navigation_menu_item_assignments') + ->whereIn('parent_id', $invalidNavigationMenuItemIds) + ->update(['parent_id' => null]); + + DB::table('navigation_menu_items') + ->where('type', 'NMI_TYPE_SERIES') + ->whereIn('navigation_menu_item_id', $invalidNavigationMenuItemIds) + ->delete(); + } + + /** + * Reverse the downgrades + * + * @throws DowngradeNotSupportedException + */ + public function down(): void + { + throw new DowngradeNotSupportedException(); + } +} diff --git a/dbscripts/xml/upgrade.xml b/dbscripts/xml/upgrade.xml index 68d1f608d4..22aecb1ffc 100644 --- a/dbscripts/xml/upgrade.xml +++ b/dbscripts/xml/upgrade.xml @@ -141,6 +141,7 @@ +