Fixed ChangeLog entity lacks default values or required attributes on old_value/new_value

Xon

Well-known member
Affected version
2.2.9
xf_change_log has the schema;
SQL:
CREATE TABLE `xf_change_log` (
  `log_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `content_type` varbinary(25) NOT NULL,
  `content_id` int(10) unsigned NOT NULL,
  `edit_user_id` int(10) unsigned NOT NULL,
  `edit_date` int(10) unsigned NOT NULL,
  `field` varchar(100) NOT NULL DEFAULT '',
  `old_value` text NOT NULL,
  `new_value` text NOT NULL,
  `protected` tinyint(3) unsigned NOT NULL DEFAULT 0,
  PRIMARY KEY (`log_id`),
  KEY `edit_date` (`edit_date`),
  KEY `content_type_content_id_date` (`content_type`,`content_id`,`edit_date`),
  KEY `content_type_date` (`content_type`,`edit_date`)
)

But the entity is lacking required attribute or a default value for old_value or new_value;
PHP:
    public static function getStructure(Structure $structure)
    {
        $structure->table = 'xf_change_log';
        $structure->shortName = 'XF:ChangeLog';
        $structure->primaryKey = 'log_id';
        $structure->columns = [
...
            'old_value' => ['type' => self::STR],
            'new_value' => ['type' => self::STR],
...
        ];
 
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.2.14).

Change log:
Mark old_value and new_value fields as required in the change log entity
There may be a delay before changes are rolled out to the XenForo Community.
 
Top Bottom