How to fake a primary key which is the sole column in a table?


How to fake a column table which is:

  • the only column in the table
  • the primary key
  • set to auto increment

I tried id: but I am getting this error message: TypeError: is not a function

Thank you


You don’t. It is an auto-incrementing primary key just insert a record and it will be populated.


You are right, but I removed the auto_increment constraint and still can not populate it:
table.integer('id', 10).primary()


I had to use faker.integer() because simply does not exist as the error message shows. If you want to understand more, you may check this: