Closed maxim-danilov closed 7 years ago
Yes, you need to use "field" field in model definition to set different name for model field and column name. I had use a beforeDefine Hook to set all "fields" to all models automatically in snake case based on camel case name I defined in JS. But you will also need to set createdAt, updatedAt and deletedAt explicitly for them to be also processed in hook
@Alexsey great thanks!
Closing since this has been answered, thanks @Alexsey
Hello! I use snake_case in my MySql DB. And I use CamelCase in my JS code. So my code looks like:
I created foreign key:
Does sequelize able to use
user_role_id
in DB andUserRoleId
in JS code?Thanks!