From dce14b8999c2ed00460123e1f026f5e604b031f3 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Wed, 23 Mar 2022 17:17:39 +0100 Subject: [PATCH] Fixed chore upgrade handling when having nonsensical user data (fixes #1826) --- changelog/67_UNRELEASED_xxxx-xx-xx.md | 1 + migrations/0166.sql | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/changelog/67_UNRELEASED_xxxx-xx-xx.md b/changelog/67_UNRELEASED_xxxx-xx-xx.md index 4c002978..0fedb2d7 100644 --- a/changelog/67_UNRELEASED_xxxx-xx-xx.md +++ b/changelog/67_UNRELEASED_xxxx-xx-xx.md @@ -33,6 +33,7 @@ - The `Daily` period type has been changed to schedule the chore at the _same time_ (based on the start date) each `n` days - This period type scheduled chores `n` days _after the last execution_ before, which is also possible by using the `Hourly` period type and a corresponding period interval; all existing `Daily` schedules will be converted to that on migration - Fixed that when consuming a parent product on chore execution (chore option "Consume product on chore execution"), no child products were used if the parent product itself is not in-stock +- Fixed that the upgrade to v3.2.0 failed when having any former "Dynamic Regular" chore with a "Period interval" of `0` (which makes absolutely no sense in reality) ### Calendar diff --git a/migrations/0166.sql b/migrations/0166.sql index e1ff4e87..78766627 100644 --- a/migrations/0166.sql +++ b/migrations/0166.sql @@ -1,6 +1,6 @@ UPDATE chores SET period_type = 'daily', -period_interval = period_days, +period_interval = CASE WHEN IFNULL(period_days, 0) = 0 THEN 1 ELSE period_days END, period_days = null WHERE period_type = 'dynamic-regular';