php - Laravel 5.1 Unknown database type enum requested -
while running php artisan migrate, got following error
[doctrine\dbal\dbalexception]
unknown database type enum requested, doctrine\dbal\platforms\mysqlplatform may not support it.
how resolve issue.
code:
public function up() { schema::table('blogs', function (blueprint $table) { $table->string('wordpress_id')->nullable(); $table->string('google_blog_id')->nullable()->change(); }); }
the official laravel 5.1 documentation states:
note: renaming columns in table enum column not supported.
it doesn't matter if you're trying change column, if table contains enum
anywhere won't work. it's doctrine dbal issue.
as workaround either drop column , add new 1 (column data lost):
public function up() { schema::table('users', function(blueprint $table) { $table->dropcolumn('name'); }); schema::table('users', function(blueprint $table) { $table->text('username'); }); }
or use db statement:
public function up() { db::statement('alter table projects change slug url varchar(200)'); } public function down() { db::statement('alter table projects change url slug varchar(200)'); }
Comments
Post a Comment