php - How to write a migrate to undo the unique constraint in Laravel? -


i make email field unique in table.

$table->unique('email');

i've tried

public function up() {     schema::table('contacts', function(blueprint $table)     {         $table->dropunique('email');     }); } 

then, when run php artisan migrate, got

enter image description here

it tell me it's not there, i'm 100% sure it's there.

enter image description here

how write migration undo ?

you have $table->dropunique('users_email_unique');

to drop index must specify index's name. laravel assigns reasonable name indexes default. concatenate table name, names of column in index, , index type.


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -