Skip to content

Instantly share code, notes, and snippets.

@bicho19
Created October 21, 2024 07:23
Show Gist options
  • Select an option

  • Save bicho19/e54606dfe540b8c04c1e0863ec83f40c to your computer and use it in GitHub Desktop.

Select an option

Save bicho19/e54606dfe540b8c04c1e0863ec83f40c to your computer and use it in GitHub Desktop.
import {
Entity,
ManyToOne,
PrimaryKey,
Property,
type Rel,
} from '@mikro-orm/core';
import { Application } from '@/modules/application/models/application.entity';
@Entity({ tableName: 'deployments' })
export class Deployment {
@PrimaryKey({ columnType: 'text' })
id: string;
@Property({ columnType: 'varchar', nullable: true })
build_command: string;
@Property({ columnType: 'varchar', nullable: true })
start_command: string;
@Property({ columnType: 'varchar', nullable: false })
url: string;
@ManyToOne(() => Application)
application: Rel<Application>;
@Property({
onCreate: () => new Date(),
columnType: 'timestamptz',
defaultRaw: 'now()',
})
created_at: Date;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment