Answers for "postgres enum type"

SQL
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
0

postgres enumerated type

CREATE TYPE mood AS ENUM ('sad', 'ok', 'happy');
Posted by: Guest on August-03-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language