cascade deletes of auth method/session FKs
This commit is contained in:
parent
1e57731b08
commit
957cc8f38c
|
@ -15,7 +15,10 @@ export class AuthMethod {
|
|||
@Column({type: 'varchar', length: 500, nullable: false})
|
||||
userIdentifier!: string;
|
||||
|
||||
@ManyToOne(() => User, user => user.authMethods)
|
||||
@ManyToOne(() => User, user => user.authMethods, {
|
||||
cascade: ['remove'],
|
||||
onDelete: 'CASCADE',
|
||||
})
|
||||
user!: User;
|
||||
|
||||
@BeforeInsert()
|
||||
|
|
|
@ -10,7 +10,10 @@ export class AuthSession {
|
|||
@PrimaryColumn({type: 'varchar', length: 26, nullable: false})
|
||||
id = ulidMonotonic();
|
||||
|
||||
@ManyToOne(() => AuthMethod, authMethod => authMethod.id, {nullable: false})
|
||||
@ManyToOne(() => AuthMethod, authMethod => authMethod.id, {
|
||||
cascade: ['remove'],
|
||||
onDelete: 'CASCADE',
|
||||
})
|
||||
authMethod!: AuthMethod;
|
||||
|
||||
// TODO expiration of sessions?
|
||||
|
|
Loading…
Reference in a new issue