Ad
Laravel Migration Uknown Database Enum Requested
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.
Ad
Answer
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.
Ad
source: stackoverflow.com
Related Questions
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
Ad