2017-08-04 65 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,非常感謝。 –