I am using Laravel 4.2. I have the following library loaded in my composer.json
\"doctrine/dbal\": \"2.4.*\",
I c
I met this problem in Laravel version 5.1.19 (LTS). This is actual for earlier versions too. I wanted to inform you as I resolved the issue base on previous comments.
First of all, I tried next code in my migration file:
$table->renameColumn('column_name');
But after command php artisan migrate, I got next error:
[Symfony\Component\Debug\Exception\FatalErrorException] Class 'Doctrine\DBAL\Driver\PDOMySql\Driver' not found
As you know DBAL was removed from the laravel core and we need add it to the composer.json.(For example:"require": {"doctrine/dbal": "2.5.1"}).
I set DBAL as required and tried again to do migrate command but got next error:
[Doctrine\DBAL\DBALException]
Unknown database type enum requested, Doctrine\DBAL\Platforms\MySqlPlatform may not support it.
Then I tried next raw sql in my migration file:
For up():
DB::statement("ALTER TABLE `table_name` CHANGE `old_column_name` `new_column_name` ENUM('first value', 'second_value', ...) DEFAULT 'first_value' AFTER `some_field`");
For down():
DB::statement("ALTER TABLE `table_name` CHANGE `new_column_name` `old_column_name` ENUM('first value', 'second_value', ...) DEFAULT 'first_value' AFTER `some_field`");
and it works.
P.S. For renaming other fields in the table which contains an enum field we should use same schema with raw sql as was written in previous comments.