Skip to content

The email and phone fields must be unique. #19

@turone

Description

@turone

The email and phone fields must be unique.
NULL values do not violate uniqueness constraints
https://postgrespro.com/docs/postgrespro/16/ddl-constraints#DDL-CONSTRAINTS-UNIQUE-CONSTRAINTS
Taking into account the requirement of uniqueness, the code will look like:

({
  Registry: {},

  login: { type: 'string', length: { min: 8, max: 64 }, unique: true },
  password: { type: 'string', note: 'Password hash' },
  active: { type: 'boolean', default: true },
  division: { many: 'Division' },
  roles: { many: 'Role' },
  fullName: '?string',
  email: {
    type: 'string',
    length: { min: 6, max: 255 },
    unique: true,
    required: false,
  },
  phone: {
    type: 'string',
    length: { min: 10, max: 15 },
    unique: true,
    required: false,
  },
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions