PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, April 14, 2022

[FIXED] How to remove primary constraint in a Laravel migration

 April 14, 2022     laravel, migration     No comments   

Issue

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?


Solution

$table->dropPrimary( 'id' );

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



Answered By - Marwane Ezzaze
Answer Checked By - Pedro (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing