Schema how to add a serial number column with auto update after each data in table

Gravatar

How to make a a table with a field Serial Number so that each data entered will be automatically numbered

User profile image
Eugene Stepnov

Hi,

Thanks for the questions!

You can do this by adding following code to the db model:

serialNumber: { type: Sequelize.INTEGER, autoIncrement: true, },

If you have any other questions, please let us know!

Cookie Consent

By continuing to browse or by clicking 'OK', you agree to the storing of cookies on your device to enhance your site experience and for analytical purposes. To learn more about how we use cookies, please see our cookies policy.