lundi 6 février 2017

Laravel 5.4 migration ENUM fails in MySQL

when I try to apply my migration, I get this error:

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

The migration is applied, enum column is created on database and I get the error, so I can't execute the nexts migrations because this migration throw this error.

In the server, I've MySQL version 5.7.17

This is the code of my migration:

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');
        });
    }
}

Thanks ;)



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2kFpN2U
via IFTTT

Aucun commentaire:

Enregistrer un commentaire