My entity file: user.ts:
@Entity('users')
export class User {
@PrimaryGeneratedColumn()
id: number | undefined;
@Column({ type: 'string', name: 'username', nullable: true })
username: string | undefined;
@Column()
password: string | undefined;
@CreateDateColumn()
createdAt: Date | undefined;
@UpdateDateColumn()
updatedAt: Date | undefined;
}
I'm getting the following error: 'Data type "string" in "User.username" is not supported by "mysql" database.'
Tried to search within typeorm issues tracker on a github, but there was no answers that would solve this issue. I run my project using tsc-watch
This is the correct usage:
@Column({ type: 'varchar', nullable: true })
username: string | undefined;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With