Im getting the error below at my entity.
Full error:
[Nest] 8844 - 09/16/2022, 6:04:23 PM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (5)...
[0] QueryFailedError: ER_PARSE_ERROR: 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, `enabled` tinyint NOT NULL DEFAULT 0, `credentials` text NULL CO' at line 1
[0] at new QueryFailedError (C:\Users\Catalin\Desktop\\api_DEV\api_DEV\node_modules\typeorm\error\QueryFailedError.js:11:28)
[0] at Query.<anonymous> (C:\Users\Catalin\Desktop\\api_DEV\api_DEV\node_modules\typeorm\driver\mysql\MysqlQueryRunner.js:170:45)
[0] at Query.<anonymous> (C:\Users\Catalin\Desktop\\api_DEV\api_DEV\node_modules\mysql\lib\Connection.js:526:10)
[0] at Query._callback (C:\Users\Catalin\Desktop\\api_DEV\api_DEV\node_modules\mysql\lib\Connection.js:488:16)
[0] at Query.Sequence.end (C:\Users\Catalin\Desktop\\api_DEV\api_DEV\node_modules\mysql\lib\protocol\sequences\Sequence.js:83:24)
[0] at Query.ErrorPacket (C:\Users\Catalin\Desktop\\api_DEV\api_DEV\node_modules\mysql\lib\protocol\sequences\Query.js:92:8)
[0] at Protocol._parsePacket (C:\Users\Catalin\Desktop\\api_DEV\api_DEV\node_modules\mysql\lib\protocol\Protocol.js:291:23)
[0] at Parser._parsePacket (C:\Users\Catalin\Desktop\\api_DEV\api_DEV\node_modules\mysql\lib\protocol\Parser.js:433:10)
[0] at Parser.write (C:\Users\Catalin\Desktop\\api_DEV\api_DEV\node_modules\mysql\lib\protocol\Parser.js:43:10)
[0] at Protocol.write (C:\Users\Catalin\Desktop\\api_DEV\api_DEV\node_modules\mysql\lib\protocol\Protocol.js:38:16)
Main error part:
ER_PARSE_ERROR: 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, `enabled` tinyint NOT NULL DEFAULT 0,
`credentials` text NULL CO' at line 1
My entity:
@Entity({name: 'webhook'})
export class WebhookEntity extends BaseEntity {
@PrimaryGeneratedColumn()
id: number;
@Column({nullable: false})
callbackUrl: string;
@Column("text",{nullable: false, array: true})
events: DeliveryStatus[];
@Column({nullable: false, default: false})
enabled: boolean;
@Column('simple-json',{
nullable: true,
comment: '{ username: string, password: string}'
})
credentials: Credentials;
}
I have tried different syntaxs, but still confused how to solve this error. If anyone have some ideas please share it to me. Thanks.