migrations relations cleanup and formatting

This commit is contained in:
Julian Krauser 2024-09-14 11:33:13 +02:00
parent 10db9a40f4
commit a0321905ce
12 changed files with 90 additions and 270 deletions

View file

@ -30,6 +30,8 @@ export class communication {
@ManyToOne(() => communicationType, (communicationType) => communicationType.communications, {
nullable: false,
onDelete: "RESTRICT",
onUpdate: "RESTRICT",
})
type: communicationType;

View file

@ -9,7 +9,7 @@ export class qualification {
@Column({ type: "varchar", length: 255 })
qualification: string;
@Column({ type: "varchar", length: 255, nullable: true, default: null })
@Column({ type: "varchar", length: 255, nullable: true })
description?: string;
@OneToMany(() => memberQualifications, (memberQualifications) => memberQualifications.qualification)

View file

@ -12,6 +12,10 @@ export class refresh {
@Column({ type: "datetime" })
expiry: Date;
@ManyToOne(() => user)
@ManyToOne(() => user, {
nullable: false,
onDelete: "CASCADE",
onUpdate: "RESTRICT",
})
user: user;
}

View file

@ -10,7 +10,11 @@ export class role {
@Column({ type: "varchar", length: 255 })
role: string;
@ManyToMany(() => user, (user) => user.roles)
@ManyToMany(() => user, (user) => user.roles, {
nullable: false,
onDelete: "CASCADE",
onUpdate: "RESTRICT",
})
users: user[];
@OneToMany(() => rolePermission, (rolePermission) => rolePermission.role)

View file

@ -10,6 +10,10 @@ export class rolePermission {
@PrimaryColumn({ type: "varchar", length: 255 })
permission: PermissionString;
@ManyToOne(() => role)
@ManyToOne(() => role, {
nullable: false,
onDelete: "CASCADE",
onUpdate: "RESTRICT",
})
role: role;
}

View file

@ -22,7 +22,11 @@ export class user {
@Column({ type: "varchar", length: 255 })
secret: string;
@ManyToMany(() => role, (role) => role.users)
@ManyToMany(() => role, (role) => role.users, {
nullable: false,
onDelete: "CASCADE",
onUpdate: "RESTRICT",
})
@JoinTable({
name: "user_roles",
})

View file

@ -10,6 +10,10 @@ export class userPermission {
@PrimaryColumn({ type: "varchar", length: 255 })
permission: PermissionString;
@ManyToOne(() => user)
@ManyToOne(() => user, {
nullable: false,
onDelete: "CASCADE",
onUpdate: "RESTRICT",
})
user: user;
}