Is there a way so all foreign key generated follows underscore user_id
instead of camelCase userId
.
Is there a way to configure TypeORM so I don't have to think about it when define the relation.
`userId` varchar(36) COLLATE utf8mb4_unicode_ci DEFAULT NULL
Yes this is possible by specifiying name
property when you define your column like such (see all possible options here https://typeorm.io/#/entities/column-options):
@Column('int', { 'name': 'user_id' })
userId: number
The database field will then be user_id
but when accessing the entity it will be mapped back to userId