Fixed Schema Manager does not change column to enum as expected


Well-known member
Affected version
I have an existing column with the schema;
`column1` varchar(25) NOT NULL DEFAULT 'value1',

I try to change this to an enum (after verifying all values are in permitted types;
$sm->alterTable('xf_sv_example', function(Alter $table)
    $table->changeColumn('column1', 'enum')
         ->values(['value1', 'value2', 'value3'])

And it generates the following SQL:
ALTER TABLE `xf_sv_example` MODIFY COLUMN `column1` ENUM(25)('value1', 'value2', 'value3') NOT NULL DEFAULT 'value1'

XF Bug Bot

XenForo bug fixer bot
Staff member
Thank you for reporting this issue. It has now been resolved and we are aiming to include it in a future XF release (2.1.3).

Change log:
If setting values in the Schema Manager, set any existing length value to null.
Any changes made as a result of this issue being resolved may not be rolled out here until later.