Type Array in column with array NOT NULL error
tahir-jamil opened this issue · comments
How can i fix this?
import { Entity, Column, PrimaryGeneratedColumn, OneToMany, CreateDateColumn } from 'typeorm';
@Entity()
export class Student {
@PrimaryGeneratedColumn()
id: number;
@Column()
firstName: string;
@Column()
lastName: string;
@Column()
username: string;
@Column()
country: string;
@Column()
city: string;
@Column()
school: string;
@Column()
address: string;
@Column()
dob: string;
@Column()
gender: string;
@Column()
mobile: string;
@Column()
email: string;
@Column()
qualification: string;
@Column("text")
title: string;
@Column('text', { array: true, default: "{'-1'}" })
perferedLanguages: string;
@Column('text', { array: true, default: "{'-1'}" })
pastExperience: string;
@Column('text', { array: true, default: "{'-1'}"})
goodSkills: string;
@Column('text', { array: true, default: "{'-1'}"})
weakSkills: string;
@CreateDateColumn()
date: any
}
[Nest] 5584 - 03/13/2021, 11:05:05 AM [ExceptionHandler] 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' at line 1 +4ms
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' at line 1
at new QueryFailedError (/Users/m.tahir/projects/projects/education/education/node_modules/typeorm/error/QueryFailedError.js:11:28)
at Query.onResult (/Users/m.tahir/projects/projects/education/education/node_modules/typeorm/driver/mysql/MysqlQueryRunner.js:216:45)
at Query.execute (/Users/m.tahir/projects/projects/education/education/node_modules/mysql2/lib/commands/command.js:30:14)
at PoolConnection.handlePacket (/Users/m.tahir/projects/projects/education/education/node_modules/mysql2/lib/connection.js:425:32)
at PacketParser.onPacket (/Users/m.tahir/projects/projects/education/education/node_modules/mysql2/lib/connection.js:75:12)
at PacketParser.executeStart (/Users/m.tahir/projects/projects/education/education/node_modules/mysql2/lib/packet_parser.js:75:16)
[11:06:25 AM] Starting compilation in watch mode...
Please report this to the TypeORM main repository. This isn't related to NestJS