繁体   English   中英

Laravel如何删除唯一列

[英]Laravel How can I remove unique column

这是我的

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

任何人都知道此错误,请告诉我! 谢谢阅读!

尝试删除$table->dropUnique('customer_plans_code_unique'); 从您的代码。

没有看到其余的代码,我无法判断该行是否重要,但这绝对是您看到此错误的原因。

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM