No Code Attached Yet
avatar softarius
softarius
13 Nov 2024

Steps to reproduce the issue

Go index.php?option=com_workflow&view=workflows&extension=com_contact
Create and save new Workflow
Click Transitions and create new transitions
Type name of transition and try click Save or Save & Close

Expected result

Saved transition

Actual result

Save failed with the following error ... "options" .. "cms_workflow_transitions" .. NOT NULL DETAIL

System information (as much as possible)

Joomla 5.2.1
PHP 8.1
Postgresql

Additional comments

I fixed it just

ALTER TABLE #__workflow_transitions
  ALTER COLUMN options SET DEFAULT '{}';
avatar softarius softarius - open - 13 Nov 2024
avatar joomla-cms-bot joomla-cms-bot - change - 13 Nov 2024
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 13 Nov 2024
avatar richard67
richard67 - comment - 13 Nov 2024

I fixed it just

ALTER TABLE #__workflow_transitions
ALTER COLUMN options SET DEFAULT '{}';

@softarius This will casue an SQL error on MySQL 8 as on MySQL 8, columns with TEXT data types (TINYTEXT, TEXT, MEDIUMTEXT, and LONGTEXT) are not allowed to have a default value. See https://dev.mysql.com/doc/refman/8.0/en/blob.html :

BLOB and TEXT columns cannot have DEFAULT values.

See also PR #27937 .

P.S.: I know, your issue and your fix are for PostgreSQL. But we want to have consistent data structures on all kinds of databases so data can be ported, that's why we also don't use default values on TEXT columns in PostgreSQL anymore.

avatar softarius
softarius - comment - 14 Nov 2024

Well, whath about this patch?

diff --git "a/www/administrator/components/com_workflow/src/Model/TransitionModel.php" "b/www/administrator/components/com_workflow/src/Model/TransitionModel.php"
index a1db4c04..d3ce79ef 100644
--- "a/www/administrator/components/com_workflow/src/Model/TransitionModel.php"
+++ "b/www/administrator/components/com_workflow/src/Model/TransitionModel.php"
@@ -177,7 +177,9 @@ class TransitionModel extends AdminModel
 
             $data['published'] = 0;
         }
-
+        if (!key_exists('options', $data) || !$data['options']) {
+            $data['options'] = '{}';
+        }
         return parent::save($data);
     }
 

avatar richard67
richard67 - comment - 14 Nov 2024

@bembelimen Could you have a look on this issue and check the fix proposed in the previous comment?

Add a Comment

Login with GitHub to post a comment