【发布时间】:2017-06-23 15:57:24
【问题描述】:
当我尝试应用迁移时,我收到此错误:
[Doctrine\DBAL\DBALException]
Unknown database type enum requested, Doctrine\DBAL\Platforms\MySQL57Platform may not support it.
应用了迁移,在数据库上创建了枚举列,我得到了错误,所以我无法执行下一个迁移,因为这个迁移抛出了这个错误。
在服务器上,我有 MySQL 5.7.17 版
这是我迁移的代码:
class AddDocumentUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->string('document', 9)->unique();
$table->enum('document_type', ['dni', 'nie', 'nif', 'cif']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('document');
$table->dropColumn('document_type');
});
}
}
谢谢 ;)
【问题讨论】:
-
阅读 laravel 文档,我看到:"以下列类型不能“更改”:char、double、enum、mediumInteger、timestamp、tinyInteger、ipAddress、json、jsonb、macAddress、 mediumIncrements、morphs、nullableMorphs、nullableTimestamps、softDeletes、timeTz、timestampTz、timestamps、timestampsTz、unsignedMediumInteger、unsignedTinyInteger、uuid。" 但我不是在尝试改变列,而是在尝试创建它。
标签: php mysql laravel-5 laravel-migrations