Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rename column name using laravel migration using doctrine/dbal gives error

Im trying to rename a database column in my localhost so that i can later do it in development and production

Im using laravel 5 and installed doctrine dbal.

Code of my migration:

    $table->renameColumn('puesto', 'aux');

After I run php artisan migrate it tells me that

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

The column im trying to rename isnt even json, although there are json column in the table, in fact only one called 'alianzas'. My question is, how can i rename the columns from the migration and not manually in the database.

like image 770
Amonra Avatar asked Apr 27 '15 23:04

Amonra


1 Answers

This error still occurs in Laravel 5.1, even when doctrine/dbal is installed.

As a temporary workaround, you could write your migration in raw SQL like so:

public function up(){
  DB::statement("ALTER TABLE table_name RENAME puesto TO aux");
}
like image 149
raphaelsaunier Avatar answered Sep 20 '22 21:09

raphaelsaunier