snowballtools-base/packages/backend/src/entity/Deployment.ts
Ashwin Phatak ea3addfd61
Backend package with db models (#43)
* Setup backend package with express server (#11)

* Setup backend package with express server

* Rename ts.config.json to tsconfig.json

* Update lint setup in backend package

* Add a dummy typeorm entity

* Remove dummy entity

---------

Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>

* Setup database connection (#13)

* Setup database connection

* Refactor database initialization into separate function

* Rename index.ts to server.ts

* Use debug package for logging

---------

Co-authored-by: neeraj <neeraj.rtly@gmail.com>

* Create entities for ER models (#14)

* Add entity for domain

* Add entity for environment variable

* Add entity for project

* Add entity for deployment

* git ignore db directory

* Add entity for organization

* Add entity for user organization and project member

* Add foreign key user and organization to project

---------

Co-authored-by: neerajvijay1997 <111040298+neerajvijay1997@users.noreply.github.com>
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-authored-by: neeraj <neeraj.rtly@gmail.com>
2024-01-16 13:40:14 +05:30

68 lines
1.1 KiB
TypeScript

import {
Entity,
PrimaryGeneratedColumn,
Column,
CreateDateColumn,
UpdateDateColumn,
ManyToOne,
OneToOne,
JoinColumn
} from 'typeorm';
import { Project } from './Project';
import { Domain } from './Domain';
enum Environment {
Production = 'Production',
Preview = 'Preview',
Development = 'Development',
}
enum Status {
Building = 'Building',
Ready = 'Ready',
Error = 'Error',
}
@Entity()
export class Deployment {
@PrimaryGeneratedColumn()
id!: number;
@ManyToOne(() => Project, { onDelete: 'CASCADE' })
@JoinColumn({ name: 'projectID' })
project!: Project;
@OneToOne(() => Domain)
@JoinColumn({ name: 'domainID' })
domain!: Domain;
@Column('varchar')
branch!: string;
@Column('varchar')
commitHash!: string;
@Column('varchar')
title!: string;
@Column({
enum: Environment
})
environment!: Environment;
@Column('boolean', { default: false })
isCurrent!: boolean;
@Column({
enum: Status
})
status!: Status;
@CreateDateColumn()
createdAt!: Date;
@UpdateDateColumn()
updatedAt!: Date;
}