TypeORM-readme-28.ts
· 479 B · TypeScript
原始文件
import {
Entity,
Column,
PrimaryGeneratedColumn,
OneToOne,
JoinColumn,
} from "typeorm"
import { Photo } from "./Photo"
@Entity()
export class PhotoMetadata {
@PrimaryGeneratedColumn()
id: number
@Column("int")
height: number
@Column("int")
width: number
@Column()
orientation: string
@Column()
compressed: boolean
@Column()
comment: string
@OneToOne(() => Photo)
@JoinColumn()
photo: Photo
}
1 | import { |
2 | Entity, |
3 | Column, |
4 | PrimaryGeneratedColumn, |
5 | OneToOne, |
6 | JoinColumn, |
7 | } from "typeorm" |
8 | import { Photo } from "./Photo" |
9 | |
10 | @Entity() |
11 | export class PhotoMetadata { |
12 | @PrimaryGeneratedColumn() |
13 | id: number |
14 | |
15 | @Column("int") |
16 | height: number |
17 | |
18 | @Column("int") |
19 | width: number |
20 | |
21 | @Column() |
22 | orientation: string |
23 | |
24 | @Column() |
25 | compressed: boolean |
26 | |
27 | @Column() |
28 | comment: string |
29 | |
30 | @OneToOne(() => Photo) |
31 | @JoinColumn() |
32 | photo: Photo |
33 | } |