TypeORM-readme-32.ts
· 288 B · TypeScript
Orginalformat
import { Entity, Column, PrimaryGeneratedColumn, OneToOne } from "typeorm"
import { PhotoMetadata } from "./PhotoMetadata"
@Entity()
export class Photo {
/* ... other columns */
@OneToOne(() => PhotoMetadata, (photoMetadata) => photoMetadata.photo)
metadata: PhotoMetadata
}
1 | import { Entity, Column, PrimaryGeneratedColumn, OneToOne } from "typeorm" |
2 | import { PhotoMetadata } from "./PhotoMetadata" |
3 | |
4 | @Entity() |
5 | export class Photo { |
6 | /* ... other columns */ |
7 | |
8 | @OneToOne(() => PhotoMetadata, (photoMetadata) => photoMetadata.photo) |
9 | metadata: PhotoMetadata |
10 | } |