Support Topics Documentation Slack YouTube Blog

Can we set a column as primary key in table?


(Subhadip Dutta) #1

Hi Team,

I am looking to create a table with a specific column as primary key and the value be an auto generated sequence like 1,2,3,4,etc.Is this possible?

Thanks & Regards,
Subhadip


(Mark Piller) #2

Hello Subhadip,

There is no auto-incrementation in the database out of the box. However, you can add a beforeCreate event handler in Cloud Code and with the help of atomic counters, you can inject a property with the incremented value.

Regards,
Mark