DragonByte Tech
Well-known member
- Affected version
- 2.0.7
Given a column e.g.
The SchemaManager will produce the following SQL:
I can work around this issue by doing this instead:
But in my opinion,
Fillip
`keywords` INT(10) UNSIGNED NOT NULL DEFAULT '0'
, if you try to alter it like so:
Code:
$sm->alterTable('xf_dbtech_mail_template', function(Alter $table)
{
$table->changeColumn('keywords', 'mediumblob')->nullable(true);
});
Which fails withALTER TABLE `xf_dbtech_mail_template`
MODIFY COLUMN `keywords` MEDIUMBLOB UNSIGNED DEFAULT '0'
- XF\Db\InvalidQueryException: MySQL statement prepare error [1064]: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNSIGNED DEFAULT '0'' at line 2
- src/XF/Db/AbstractStatement.php:212
I can work around this issue by doing this instead:
Code:
$sm->alterTable('xf_dbtech_mail_template', function(Alter $table)
{
$table->changeColumn('keywords', 'mediumblob')
->nullable(true)
->unsigned(false)
->setDefault(null)
;
});
changeColumn
should reset the column definition so that you don't have to "undo" keywords or default values from the previous configuration.Fillip