【发布时间】:2016-01-13 10:59:54
【问题描述】:
在运行 php artisan migrate 时,出现以下错误
[Doctrine\DBAL\DBALException]
请求的未知数据库类型枚举,Doctrine\DBAL\Platforms\MySqlPlatform 可能不支持它。
如何解决此问题。
代码:
public function up() {
Schema::table('blogs', function (Blueprint $table) {
$table->string('wordpress_id')->nullable();
$table->string('google_blog_id')->nullable()->change();
});
}
【问题讨论】:
-
请发布您要迁移的架构。
-
public function up() { Schema::table('blogs', function (Blueprint $table) { $table->string('wordpress_id')->nullable(); $table-> string('google_blog_id')->nullable()->change(); }); }
-
您的表是否包含
enum列? -
是的.. 它有一个枚举类型字段。在另一个迁移中(但此迁移工作正常),我有以下 'DB::statement('ALTER TABLE blogs MODIFY type enum("wordpress","blogger") NULL;');'
-
Laravel 目前不支持用枚举列重命名表中的列。如果您尝试更改另一列,则无关紧要。如果表中包含
enum,它将不起作用。恐怕您将不得不以某种方式手动更改它,或者尝试一些相当丑陋的黑客或解决方法。
标签: php laravel laravel-4 laravel-5