import { Entity , PrimaryGeneratedColumn , Column , CreateDateColumn , UpdateDateColumn , JoinColumn , ManyToOne , } from 'typeorm' ; import OptionEntity from './option' ; @ Entity ( { name : 'option_item' } ) class OptionItemEntity { @ PrimaryGeneratedColumn ( ) idx : number ; @ Column ( { length : 45 } ) name : string ; @ ManyToOne ( ( ) => OptionEntity , optionEntity => optionEntity . idx , { onDelete : 'CASCADE' , nullable : false , } ) @ JoinColumn ( { name : 'option_idx' } ) option : OptionEntity ; @ CreateDateColumn ( { type : 'timestamp' } ) createdAt : Date ; @ UpdateDateColumn ( { type : 'timestamp' } ) updatedAt : Date ; } export default OptionItemEntity ;