import {
	Column,
	Entity,
	ObjectIdColumn,
	PrimaryGeneratedColumn,
} from "typeorm";
import { BaseClassWithoutId } from ".";

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;
}
