-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
NodeJS-Application/schemas/Account.js
Line 13 in 5749fec
| index: true, |
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
Labels
No labels