Live application have order 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');
});
Now I need to update status field in that table, but I want to save old data in database. So I created one more migration which will update status field in order table.
Schema::table('order', function($table){
$table->enum('status', array('CREATED','FINISHED','CLOSED'))->default('CREATED')->change();
});
But when i run php artisan migrate I got error saying Unknow database type enum requested, Doctrine\DBal\Platforms\MySqlPlatform may not support it.
I suggest you to use facade of query builder to achieve the same,
DB::statement("ALTER TABLE order CHANGE COLUMN status status
ENUM('CREATED', 'FINISHED', 'CLOSED') NOT NULL DEFAULT 'CREATED'");
By raw migration it is not possible,
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With