简体   繁体   中英

How can I remove unique column laravel 5

How can I dropUnique the column a_b from z table?

If it would be just column a, we can do this:

$table->dropUnique('z_a_unique');

I've tried:

$table->dropUnique('z_a_b_unique');

But obviously it didn't work. Thanks for your help in advance!

dropUnqiue() will drop index, not the column. You need to use dropColumn() after dropUnique() :

$table->dropColumn('a_b');

Actually, the answer is in the question, sorry guys, it works like this:

$table->dropUnique('z_a_b_unique');

And solved my problem

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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