0

Basically laravel migration has a default id which is a number starting from 1 and so on which is incremental, but I want to create an id whose contents are a mixture of numbers and strings in a database, how do I replace the id in laravel migration with the id I want?

for example I want to create id 'AA001' and increase automatically as the data in the database increases such as 'AA002', 'AA003' and so on.

Shadow
  • 33,525
  • 10
  • 51
  • 64
  • Does this answer your question? [MySQL - how to use VARCHAR as AUTO INCREMENT Primary Key](https://stackoverflow.com/questions/3455557/mysql-how-to-use-varchar-as-auto-increment-primary-key) – FanoFN Mar 14 '23 at 02:38
  • @FanoFN i dont think so bcs i want to generate that id on laravel migration not on mysql – Willyawan Maulana Mar 14 '23 at 02:50
  • Is laravel migration able to store id? If not, where is the source for "last id" to generate the incremental value? – FanoFN Mar 14 '23 at 03:39
  • May be this video will help you https://www.youtube.com/watch?v=WxCGsz2Drgg – Sushant Aryal Mar 14 '23 at 10:08

0 Answers0