From a369a6bde7c220040c4fb59721095814be2baecb Mon Sep 17 00:00:00 2001 From: William Oldham Date: Sat, 4 Nov 2023 12:51:22 +0000 Subject: [PATCH] Public Key should be unique Co-authored-by: mrjvs --- src/db/models/User.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/db/models/User.ts b/src/db/models/User.ts index 144b013..e055009 100644 --- a/src/db/models/User.ts +++ b/src/db/models/User.ts @@ -1,4 +1,11 @@ -import { Entity, Index, PrimaryKey, Property, types } from '@mikro-orm/core'; +import { + Entity, + Index, + PrimaryKey, + Property, + Unique, + types, +} from '@mikro-orm/core'; import { nanoid } from 'nanoid'; export type UserProfile = { @@ -13,7 +20,7 @@ export class User { id: string = nanoid(12); @Property({ name: 'public_key', type: 'text' }) - @Index() + @Unique() publicKey!: string; @Property({ name: 'namespace' })