我在用拉拉维尔 5.1 https://laravel.com/docs/5.1我有一个名为 packages 的表,其结构如下:
id int(11)
weight decimal(10,2)
weight_unit enum('Kg.', 'Gm.')
我想改变weight_unit
枚举到:
weight_unit enum('Grams','Kgs.','Pounds')
为此,我创建了以下迁移:
public function up()
{
Schema::table('packages', function ($table) {
$table->enum('weight_unit', array('Grams','Kgs.','Pounds'))->nullable()->change();
});
}
但是当我运行迁移时,我收到一个错误:
Unknown database type enum requested, Doctrine\DBAL\Platforms\MySqlPlatform
may not support it.
我怎样才能改变这个枚举?
Use the DB::statement
method:
DB::statement("ALTER TABLE packages MODIFY COLUMN weight_unit ENUM('Grams', 'Kgs', 'Pounds')");
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)