Fixed Schema Manager does not change column to enum as expected

Affected version
2.1.2

Xon

Well-known member
I have an existing column with the schema;
Code:
`column1` varchar(25) NOT NULL DEFAULT 'value1',
I try to change this to an enum (after verifying all values are in permitted types;
PHP:
$sm->alterTable('xf_sv_example', function(Alter $table)
{
    $table->changeColumn('column1', 'enum')
         ->values(['value1', 'value2', 'value3'])
         ->setDefault('value1');
});
And it generates the following SQL:
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.
 
Top