refactor(server): use cascades for keys and tokens (#2544)

This commit is contained in:
Jason Rasmussen
2023-05-23 16:40:04 -04:00
committed by GitHub
parent e2bd7e1e08
commit 50a792a81a
19 changed files with 100 additions and 126 deletions

View File

@@ -12,7 +12,7 @@ export class APIKeyEntity {
@Column({ select: false })
key?: string;
@ManyToOne(() => UserEntity)
@ManyToOne(() => UserEntity, { onUpdate: 'CASCADE', onDelete: 'CASCADE' })
user?: UserEntity;
@Column()

View File

@@ -12,7 +12,7 @@ export class UserTokenEntity {
@Column()
userId!: string;
@ManyToOne(() => UserEntity)
@ManyToOne(() => UserEntity, { onUpdate: 'CASCADE', onDelete: 'CASCADE' })
user!: UserEntity;
@CreateDateColumn({ type: 'timestamptz' })