0

How to add column auto increments but not primary key in Laravel migrations and exists table, its have primary key is id. I'm using Laravel 5.7 and pgsql.

hieu pham ba
  • 113
  • 1
  • 7
  • Possible duplicate of [How to set auto increment into non primary key?](https://stackoverflow.com/questions/42929776/how-to-set-auto-increment-into-non-primary-key) – Mozammil Jan 23 '19 at 06:10
  • I try this but it fails: `multiple primary keys for table "table_names" are not allowed` – hieu pham ba Jan 23 '19 at 06:15

1 Answers1

0

I guess adding an AUTO_INCREMENT column automatically creates a primary key for that column.

Because you are making some other column AUTO_INCREMENT,means you have two column with AUTO_INCREMENT,so Laravel is confused as it is getting two Primary Key.

Prashant Deshmukh.....
  • 2,244
  • 1
  • 9
  • 11