Laravel如何删除唯一的列

时间:2016-04-08 03:31:18

标签: laravel eloquent unique

这是我的

public function down()
{
    Schema::table('customer_plans', function (Blueprint $table) {
        $table->dropUnique('customer_plans_code_unique');
        $table->string('code',255)->change();
        $table->string('name',255)->change();
    });
}

我这样做是为laravel.com但我收到了这个错误

  [PDOException]
  SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP   'customer_plans_code_unique'; check that column/
  key exists

任何人都知道这个错误,请告诉我! 谢谢你的阅读!

1 个答案:

答案 0 :(得分:2)

尝试从代码中删除Spring

如果没有看到剩下的代码,我就无法判断该行是否重要,但这肯定是您看到错误的原因。

告诉我你的up()函数,我可以给你更多反馈。