【发布时间】:2020-01-14 03:35:51
【问题描述】:
实时应用程序有订单表。
Schema::create('order', function($table){
$table->increments('id');
$table->integer('user_id')->unsigned();
$table->dateTime('date')->nullable();
$table->enum('status', array('CREATED','FINISHED'))->default('CREATED');
});
现在我需要更新该表中的状态字段,但我想将旧数据保存在数据库中。所以我又创建了一个迁移,它将更新订单表中的状态字段。
Schema::table('order', function($table){
$table->enum('status', array('CREATED','FINISHED','CLOSED'))->default('CREATED')->change();
});
但是当我运行php artisan migrate 时,我收到错误消息Unknow database type enum requested, Doctrine\DBal\Platforms\MySqlPlatform may not support it.
【问题讨论】:
-
来自documentation: "只有以下列类型可以“更改”:bigInteger、binary、boolean、date、dateTime、dateTimeTz、decimal、integer、json、longText、mediumText 、smallInteger、string、text、time、unsignedBigInteger、unsignedInteger 和 unsignedSmallInteger。” 以及“当前不支持重命名表中也有 enum 类型的列的任何列。”
标签: php laravel laravel-migrations