Answers for "typeorm enum postgres"

1

typeorm enum postgres

export enum UserRole {
    ADMIN = "admin",
    EDITOR = "editor",
    GHOST = "ghost"
}

@Entity()
export class User {

    @PrimaryGeneratedColumn()
    id: number;

    @Column({
        type: "enum",
        enum: UserRole,
        default: UserRole.GHOST
    })
    role: UserRole;

}
Posted by: Guest on December-16-2020

Browse Popular Code Answers by Language