mardi 29 mars 2016

In Laravel 5, migration to drop composed unique key doesn't work

Trying to make a migration to drop composed unique key fails without errors.

I've created a migration with php artisan make:migration and edited the code. So I have this

public function up()
{
    Schema::table('ques_trilha_itens', function (Blueprint $table) {
        $table->dropUnique('trilha_itens_trilha_id_questao_id_unique');
    });
}

/**
 * Reverse the migrations.
 *
 * @return void
 */
public function down()
{
    Schema::table('ques_trilha_itens', function (Blueprint $table) {
        $table->unique(['trilha_id', 'questao_id']);
    });
}

The string 'trilha_itens_trilha_id_questao_id_unique' is the one that is displayed as the composed unique key in MySQL. So I think that string is to be used do drop the two composed keys.

But when running php artisan migrate, nothing happens, no error messages, and the migration is not executed.

I tried substitute the string in dropUnique to give the table's name as the first term ('ques_trilha_itens_trilha_id_questao_id_unique') and nothing.

Is something I'm missing?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire