Skip to content

Commit

Permalink
Adding more indices to fields and improving SQL queries #437
Browse files Browse the repository at this point in the history
  • Loading branch information
bpatrik committed Dec 4, 2022
1 parent 65c4ab1 commit eea77a5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 41 deletions.
41 changes: 0 additions & 41 deletions src/backend/model/database/sql/enitites/FaceRegionEntry.ts

This file was deleted.

28 changes: 28 additions & 0 deletions src/backend/model/database/sql/enitites/PersonJunctionTable.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import {Entity, Index, ManyToOne, PrimaryGeneratedColumn} from 'typeorm';
import {PersonEntry} from './PersonEntry';
import {MediaEntity} from './MediaEntity';


/**
* This is a junction table between media and persons
*/
@Entity()
export class PersonJunctionTable {
@Index()
@PrimaryGeneratedColumn({unsigned: true})
id: number;

@Index()
@ManyToOne((type) => MediaEntity, (media) => media.metadata.faces, {
onDelete: 'CASCADE',
nullable: false,
})
media: MediaEntity;

@Index()
@ManyToOne((type) => PersonEntry, (person) => person.faces, {
onDelete: 'CASCADE',
nullable: false,
})
person: PersonEntry;
}

0 comments on commit eea77a5

Please sign in to comment.