Skip to content

In Sequelize, how do you make default value unique, random and n digits long? #9263

@techsin

Description

@techsin

What are you doing?

currently I've a function returning x number of digits that are randomly generated: 324322, 28393, 3294329, 928593, 032293,..... so on. I need them to be unique as well. I've unique constraint on the field. My question is would sequelize try again if unique constraint fails?? If not then what is the good way to fix this as I can't make value really long to prevent collisions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions