forked from typeorm/typeorm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entities.ts
34 lines (30 loc) · 794 Bytes
/
entities.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { PrimaryColumn, Generated, ManyToMany, Entity, Column, JoinTable } from "../../../../../src";
@Entity()
export class FooEntity {
@PrimaryColumn({ type: "int", width: 10, unsigned: true, nullable: false })
@Generated()
public id: number;
@ManyToMany(() => BarEntity)
@JoinTable({
name: "foo_bars",
joinColumns: [
{
name: "foo_id",
}
],
inverseJoinColumns: [
{
name: "bar_id",
}
]
})
public fooBars: BarEntity[];
}
@Entity()
export class BarEntity {
@PrimaryColumn({ type: "int", width: 10, unsigned: true })
@Generated()
public id: number;
@Column("varchar", { nullable: false, length: 50 })
public code: string;
}