2017-08-04 196 views
0

如何使用Programmatic API选项在sequelize-auto中获取camelCase列名称?我已经尝试过这样的:sequelize-auto:程序化API选项中的驼峰案例

const options = { 
    host: 'localhost', 
    dialect: 'mysql', 
    directory: './models', 
    port: '3306', 
    logging: false, 
    additional: { 
     camel: true, 
     timestamps: false 
    } 
} 

const options = { 
    host: 'localhost', 
    dialect: 'mysql', 
    directory: './models', 
    port: '3306', 
    logging: false, 
    camel: true, 
    additional: { 
     timestamps: false 
    } 
} 

但这一切似乎工作,我究竟做错了什么?

最好的问候。

回答

1

根据https://github.com/sequelize/sequelize-auto/blob/master/lib/index.js它看起来像你接近!你只需要在camel选项重命名为camelCase因为如此...

const options = { 
    host: 'localhost', 
    dialect: 'mysql', 
    directory: './models', 
    port: '3306', 
    logging: false, 
    camelCase: true, // <-- Do this! 
    additional: { 
     timestamps: false 
    } 
} 

祝你好运! :)

+0

红眼@Dylan Aspden,非常感谢。 –