简体   繁体   中英

How to remove primary constraint in a Laravel migration

I had a migration with the following constraint:

$table->uuid('id')->primary();

is it possible to remove this primary() constraint in a following migration? I tried this:

$table->uuid('id')->change();

but it doesn't work. What's the recommended approach?

try dropPrimary method :

  $table->dropPrimary('id');

this will drop only the key constraint not the column

$table->dropPrimary( 'id' );

参考: https : //laravel.com/docs/5.0/schema#dropping-indexes

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