Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The email and phone fields must be unique. #19

Open
turone opened this issue Apr 26, 2024 · 0 comments
Open

The email and phone fields must be unique. #19

turone opened this issue Apr 26, 2024 · 0 comments

Comments

@turone
Copy link
Member

turone commented Apr 26, 2024

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,
  },
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant