unique fields for tables

This commit is contained in:
Julian Krauser 2025-01-28 11:09:42 +01:00
parent 684c24e4fd
commit 4378c02d17
16 changed files with 144 additions and 19 deletions

View file

@ -32,7 +32,11 @@ export class member {
@OneToMany(() => communication, (communications) => communications.member)
communications: communication[];
@ManyToOne(() => salutation, (salutation) => salutation.members)
@ManyToOne(() => salutation, (salutation) => salutation.members, {
nullable: false,
onDelete: "RESTRICT",
onUpdate: "RESTRICT",
})
salutation: salutation;
@OneToMany(() => membership, (membership) => membership.member)

View file

@ -9,7 +9,7 @@ export class newsletter {
@PrimaryColumn({ generated: "increment", type: "int" })
id: number;
@Column({ type: "varchar", length: 255 })
@Column({ type: "varchar", length: 255, unique: true })
title: string;
@Column({ type: "varchar", length: 255, default: "" })

View file

@ -5,7 +5,7 @@ export class protocol {
@PrimaryColumn({ generated: "increment", type: "int" })
id: number;
@Column({ type: "varchar", length: 255 })
@Column({ type: "varchar", length: 255, unique: true })
title: string;
@Column({ type: "date" })

View file

@ -6,8 +6,8 @@ export class refresh {
@PrimaryColumn({ type: "varchar", length: 255 })
token: string;
@PrimaryColumn({ type: "int" })
userId: number;
@PrimaryColumn()
userId: string;
@Column({ type: "datetime" })
expiry: Date;

View file

@ -6,7 +6,7 @@ export class award {
@PrimaryColumn({ generated: "increment", type: "int" })
id: number;
@Column({ type: "varchar", length: 255 })
@Column({ type: "varchar", length: 255, unique: true })
award: string;
@OneToMany(() => memberAwards, (member) => member.award)

View file

@ -6,7 +6,7 @@ export class calendarType {
@PrimaryColumn({ generated: "increment", type: "int" })
id: number;
@Column({ type: "varchar", length: 255 })
@Column({ type: "varchar", length: 255, unique: true })
type: string;
@Column({ type: "boolean" }) // none specified cal dav request

View file

@ -7,7 +7,7 @@ export class communicationType {
@PrimaryColumn({ generated: "increment", type: "int" })
id: number;
@Column({ type: "varchar", length: 255 })
@Column({ type: "varchar", length: 255, unique: true })
type: string;
@Column({

View file

@ -6,7 +6,7 @@ export class executivePosition {
@PrimaryColumn({ generated: "increment", type: "int" })
id: number;
@Column({ type: "varchar", length: 255 })
@Column({ type: "varchar", length: 255, unique: true })
position: string;
@OneToMany(() => memberExecutivePositions, (memberExecutivePositions) => memberExecutivePositions.executivePosition)

View file

@ -6,7 +6,7 @@ export class membershipStatus {
@PrimaryColumn({ generated: "increment", type: "int" })
id: number;
@Column({ type: "varchar", length: 255 })
@Column({ type: "varchar", length: 255, unique: true })
status: string;
@OneToMany(() => membership, (membership) => membership.status)

View file

@ -6,7 +6,7 @@ export class qualification {
@PrimaryColumn({ generated: "increment", type: "int" })
id: number;
@Column({ type: "varchar", length: 255 })
@Column({ type: "varchar", length: 255, unique: true })
qualification: string;
@Column({ type: "varchar", length: 255, nullable: true })

View file

@ -5,7 +5,7 @@ export class template {
@PrimaryColumn({ generated: "increment", type: "int" })
id: number;
@Column({ type: "varchar", length: 255 })
@Column({ type: "varchar", length: 255, unique: true })
template: string;
@Column({ type: "varchar", length: 255, nullable: true })

View file

@ -7,7 +7,7 @@ export class role {
@PrimaryColumn({ generated: "increment", type: "int" })
id: number;
@Column({ type: "varchar", length: 255 })
@Column({ type: "varchar", length: 255, unique: true })
role: string;
@ManyToMany(() => user, (user) => user.roles, {

View file

@ -4,13 +4,13 @@ import { userPermission } from "./user_permission";
@Entity()
export class user {
@PrimaryColumn({ generated: "increment", type: "int" })
id: number;
@PrimaryColumn({ generated: "uuid", type: "varchar" })
id: string;
@Column({ type: "varchar", length: 255 })
@Column({ type: "varchar", unique: true, length: 255 })
mail: string;
@Column({ type: "varchar", length: 255 })
@Column({ type: "varchar", unique: true, length: 255 })
username: string;
@Column({ type: "varchar", length: 255 })

View file

@ -4,8 +4,8 @@ import { PermissionObject, PermissionString } from "../../type/permissionTypes";
@Entity()
export class userPermission {
@PrimaryColumn({ type: "int" })
userId: number;
@PrimaryColumn()
userId: string;
@PrimaryColumn({ type: "varchar", length: 255 })
permission: PermissionString;