title: 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
body: <p>I am modifying a TypeOrm entity, and I broke the code somehow, but it's very difficult to get what's wrong.</p>
  <p>All I have as a error message is :</p>
  <blockquote>
  <p>[Nest] 31328   - 21/12/2021, 15:15:05   [TypeOrmModule] Unable to connect to the database. Retrying (1)... +269ms</p>
  <p>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 NOT NULL, <code>sessionId</code> varchar(36) NULL, PRIMARY KEY (<code>id</code>)) ENGINE=InnoDB' at line 1</p>
  <p>at QueryFailedError.TypeORMError [as constructor] (/Users/arthurmehmetoglu/Development/CorpoSano/back/src/error/TypeORMError.ts:7:9)<br />
  at new QueryFailedError (/Users/arthurmehmetoglu/Development/CorpoSano/back/src/error/QueryFailedError.ts:9:9)<br />
  at Query.onResult (/Users/arthurmehmetoglu/Development/CorpoSano/back/src/driver/mysql/MysqlQueryRunner.ts:183:37)<br />
  at Query.execute (/Users/arthurmehmetoglu/Development/CorpoSano/back/node_modules/mysql2/lib/commands/command.js:36:14)<br />
  at PoolConnection.handlePacket (/Users/arthurmehmetoglu/Development/CorpoSano/back/node_modules/mysql2/lib/connection.js:456:32)<br />
  at PacketParser.onPacket (/Users/arthurmehmetoglu/Development/CorpoSano/back/node_modules/mysql2/lib/connection.js:85:12)<br />
  at PacketParser.executeStart (/Users/arthurmehmetoglu/Development/CorpoSano/back/node_modules/mysql2/lib/packet_parser.js:75:16)<br />
  at Socket. (/Users/arthurmehmetoglu/Development/CorpoSano/back/node_modules/mysql2/lib/connection.js:92:25)<br />
  at Socket.emit (node:events:390:28)<br />
  at addChunk (node:internal/streams/readable:315:12)</p>
  </blockquote>
  <p>Any idea how could get more information on what TypeOrm is trying to perform here?</p>
  <p>EDIT: After reading carefully the error message, the only clue is that the <code>sessionId</code> is causing some trouble for some reason.</p>
  <p>So I am sharing here are the entities that potentially involved:</p>
  <pre><code>@Entity()
  export class Session extends BaseEntity {
    @ManyToOne(() =&gt; Workout, (workout) =&gt; workout.sessions)
    workout: Workout
  
    @OneToMany(() =&gt; Performance, (performance) =&gt; performance.session, {
      eager: true,
    })
    performances: Performance[]
  
    constructor(partial: Partial&lt;Session&gt; = {}) {
      super()
      Object.assign(this, partial)
    }
  }
  </code></pre>
  <pre><code>@Entity()
  export class Performance extends BaseEntity {
    @ManyToOne(() =&gt; Session, (session) =&gt; session.performances)
    session: Session
  
    @Column('int', { array: true })
    sets: number[]
  
    constructor(partial: Partial&lt;Performance&gt; = {}) {
      super()
      Object.assign(this, partial)
    }
  }
  </code></pre>
  <pre><code>@Entity()
  export class Workout extends BaseEntity {
    @Column()
    title: string
  
    @ManyToOne(() =&gt; Program, (program) =&gt; program.workouts)
    program?: Program
  
    @OneToMany(() =&gt; Exercise, (exercise) =&gt; exercise.workout, { eager: true })
    exercises?: Exercise[]
  
    @OneToMany(() =&gt; Session, (session) =&gt; session.workout)
    sessions?: Session[]
  
    @Column({
      type: 'set',
      enum: WeekDays,
      default: [],
    })
    scheduledDays?: WeekDays[]
  
    constructor(partial: Partial&lt;Workout&gt; = {}) {
      super()
      Object.assign(this, partial)
    }
  }
  </code></pre>