-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding more indices to fields and improving SQL queries #437
- Loading branch information
Showing
2 changed files
with
28 additions
and
41 deletions.
There are no files selected for viewing
41 changes: 0 additions & 41 deletions
41
src/backend/model/database/sql/enitites/FaceRegionEntry.ts
This file was deleted.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
src/backend/model/database/sql/enitites/PersonJunctionTable.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |