I am doing a lot of research and experiment to use an enum array in my entity.
import { Program } from '../../program/entities/program.entity'
import {
Column,
Entity,
JoinTable,
ManyToMany,
ManyToOne,
PrimaryGeneratedColumn,
} from 'typeorm'
import { Exercise } from '../../exercise/entities/exercise.entity'
import { WeekDays } from '../types/week-days.enum'
@Entity()
export class Workout {
// [...]
@Column({
type: 'enum',
enum: WeekDays,
default: [],
array: true,
})
scheduledDays?: WeekDays[]
constructor(partial: Partial<Workout> | {} = {}) {
Object.assign(this, partial)
}
}
Unfortunately it gives me this error.
QueryFailedError: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'array ('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sund' at line 1
How can I solve this? I can't get what's wrong on my decorator options.