Laravel 请求迁移未知数据库枚举

Laravel migration uknown database enum requested

实时应用程序有订单 table。

    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');
    });

现在我需要更新 table 中的状态字段,但我想将旧数据保存在数据库中。所以我又创建了一个迁移,它将按 table.

的顺序更新状态字段
    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.

我建议您使用查询生成器的外观来实现相同的目的,

DB::statement("ALTER TABLE order CHANGE COLUMN status status  
ENUM('CREATED', 'FINISHED', 'CLOSED') NOT NULL DEFAULT 'CREATED'");

通过原始迁移是不可能的,

NOTE:- Only the following column types can be "changed": bigInteger, binary, boolean, date, dateTime, dateTimeTz, decimal, integer, json, longText, mediumText, smallInteger, string, text, time, unsignedBigInteger, unsignedInteger and unsignedSmallInteger.