summary refs log tree commit diff
path: root/src/util/entities/Migration.ts
blob: 072014de1efabc055f28e9da50aa884b5ed4d1c5 (plain) (blame)
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
import {
	Column,
	Entity,
	ObjectIdColumn,
	PrimaryGeneratedColumn,
} from "typeorm";
import { BaseClassWithoutId } from "./BaseClass";

export const PrimaryIdAutoGenerated = process.env.DATABASE?.startsWith(
	"mongodb",
)
	? ObjectIdColumn
	: PrimaryGeneratedColumn;

@Entity("migrations")
export class Migration extends BaseClassWithoutId {
	@PrimaryIdAutoGenerated()
	id: number;

	@Column({ type: "bigint" })
	timestamp: number;

	@Column()
	name: string;
}