From f35e360a3b9201c9b0f36773af44eed228b9e272 Mon Sep 17 00:00:00 2001 From: Simey Lameze Date: Thu, 21 Nov 2019 08:36:22 +0800 Subject: [PATCH] MDL-67312 calendar: upgrade step to delete orphaned events --- lib/db/upgrade.php | 10 ++++++++++ version.php | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index b87c6c12459..1a7ebc4da5a 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -2162,5 +2162,15 @@ function xmldb_main_upgrade($oldversion) { upgrade_main_savepoint(true, 2020010900.02); } + + if ($oldversion < 2020011700.02) { + // Delete all orphaned subscription events. + $select = "subscriptionid IS NOT NULL + AND subscriptionid NOT IN (SELECT id from {event_subscriptions})"; + $DB->delete_records_select('event', $select); + + upgrade_main_savepoint(true, 2020011700.02); + } + return true; } diff --git a/version.php b/version.php index fa86dab819f..41211112a4e 100644 --- a/version.php +++ b/version.php @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2020011700.01; // YYYYMMDD = weekly release date of this DEV branch. +$version = 2020011700.02; // YYYYMMDD = weekly release date of this DEV branch. // RR = release increments - 00 in DEV branches. // .XX = incremental changes. $release = '3.9dev (Build: 20200117)'; // Human-friendly version name -- 2.43.0