Sequelize use camel case in JS but underscores in table names

前端 未结 4 1168
暖寄归人
暖寄归人 2020-12-29 02:36

Is it possible to have column names be underscored (postgres) but have the JavaScript getters be camelCase per language standards?

4条回答
  •  长发绾君心
    2020-12-29 02:49

    For anyone finding this later on it's now possible to explicitely define what the database field should be named:

    var User = sequelize.define('user', {
      isAdmin: {
        type: DataTypes.BOOLEAN,
        field: 'is_admin'
      }
    });
    

提交回复
热议问题