From 02c15f321aa4e688bd5b7e330d4be8229d22b7eb Mon Sep 17 00:00:00 2001 From: GuySartorelli <36352093+GuySartorelli@users.noreply.github.com> Date: Mon, 21 Jun 2021 09:58:35 +1200 Subject: [PATCH] Fix: Allow removing the Versioned extension from EditableFormField fixes #1082 --- code/Model/EditableFormField.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/Model/EditableFormField.php b/code/Model/EditableFormField.php index f923b87..41e3496 100755 --- a/code/Model/EditableFormField.php +++ b/code/Model/EditableFormField.php @@ -345,8 +345,10 @@ class EditableFormField extends DataObject // make sure to migrate the class across (prior to v5.x) DB::query("UPDATE \"EditableFormField\" SET \"ParentClass\" = 'Page' WHERE \"ParentClass\" IS NULL"); - DB::query("UPDATE \"EditableFormField_Live\" SET \"ParentClass\" = 'Page' WHERE \"ParentClass\" IS NULL"); - DB::query("UPDATE \"EditableFormField_Versions\" SET \"ParentClass\" = 'Page' WHERE \"ParentClass\" IS NULL"); + if (self::has_extension(Versioned::class)) { + DB::query("UPDATE \"EditableFormField_Live\" SET \"ParentClass\" = 'Page' WHERE \"ParentClass\" IS NULL"); + DB::query("UPDATE \"EditableFormField_Versions\" SET \"ParentClass\" = 'Page' WHERE \"ParentClass\" IS NULL"); + } } /**