0
这是我的Laravel如何删除唯一列
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-> unique('code',50);'in up()。谢谢! –
在这种情况下,只有'$ table-> dropUnique('code');'应该在你的'down()'函数中。另外,如果你发现我的答案有帮助,如果你愿意,我会很感激。 –
非常感谢!这行得通 –