Handling Automatic ID Generation in PostgreSQL With Node.js and Sequelize

There are many ways to handle ID generation in PostgreSQL, but I’ve chosen to investigate these four approaches:

  1. Auto-incrementing (SERIAL data type)
  2. Sequence-caching
  3. Sequence-incrementing with client-side ID management
  4. UUID-generation

Depending on your application and your underlying database tables, you might choose to employ one or more of these options. Below, I’ll explain how each can be achieved in Node.js using the Sequelize ORM.

This article has been indexed from DZone Security Zone

Read the original article: