Latheesan Latheesan - 5 months ago 127
PHP Question

Laravel db migration - renameColumn error - Unknown database type enum requested

I am using Laravel

4.2
. I have the following library loaded in my
composer.json


"doctrine/dbal": "2.4.*",


I created the following migration:

class RenameDeliveryNotesColumnOnOrderHeaderTable extends Migration {

public function up()
{
Schema::table('order_header', function(Blueprint $table)
{
$table->renameColumn('delivery_notes', 'packing_notes');
});
}

}


Where
delivery_notes
column type is
text
.

When I run the migration, I get the following error:


[Doctrine\DBAL\DBALException] Unknown database type enum requested,
Doctrine\DBAL\Platforms\MySqlPlatform may not support it.


Any idea why I am getting this error? How should I go about fixing this? I need to rename a column in my table. Are there any alternative way to rename the column?

Answer

I googled your issue a bit and I found out that it's a known issue.

Laravel's docs (http://laravel.com/docs/4.2/schema#renaming-columns) say that

Note: Renaming enum column types is not supported.

Here: https://github.com/laravel/framework/issues/1186

You can find some workarounds about this issue. And since you said that this column is not enum, take a look at @upngo's comment:

"...The issue is renaming ANY column on a table that has an enum."

Also I found this article that focuses on this issue and suggest an option that might help you.

http://www.paulbill.com/110/laravel-unknown-database-type-enum-requested-doctrinedbalplatformsmysqlplatform-may-not-support-it