Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Laravel如何删除唯一列_Laravel_Eloquent_Unique - Fatal编程技术网

Laravel如何删除唯一列

Laravel如何删除唯一列,laravel,eloquent,unique,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)->

这是我的

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\u plan\u code\u unique')来自您的代码

在看不到其余代码的情况下,我无法判断这行代码是否重要,但这肯定是您看到错误的原因


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

尝试删除
$table->dropUnique('customer\u plan\u code\u unique')来自您的代码

在看不到其余代码的情况下,我无法判断这行代码是否重要,但这肯定是您看到错误的原因


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

只需
$table->unique('code',50)在up()中。谢谢你!在这种情况下,只有
$table->dropUnique('code')
应该在
down()函数中。另外,如果你觉得我的答案有帮助,如果你能接受,我将不胜感激在up()中。谢谢你!在这种情况下,只有
$table->dropUnique('code')
应该在
down()函数中。另外,如果你觉得我的回答有帮助,如果你能接受,我将不胜感激。