In migration, if we want to add a primary key on table, we use
$table->increments('id');
This will create an id field with int(10)
But I don't found any way to customize the primary key. Like what if I want primary key with string type or int with size 5 etc...
BTW, I want the primary key of tiny type. How can I achieve that using migration?
Thanks, Parth Vora
You can customize Primary Key by using primary
method as:
$table->tinyInteger('pk');
$table->primary('pk');