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()函数中。另外,如果你觉得我的回答有帮助,如果你能接受,我将不胜感激。