没有选项来映射sequelize模型中的列名 [英] Is there no option to map the column name in sequelize model

查看:36
本文介绍了没有选项来映射sequelize模型中的列名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个给定的数据库,其中包含长而繁琐的列名.没有任何方法可以将表名映射到模型中较短且更具描述性的propertyNames上吗? 像

I have a given database with long, cumbersome columnnames. Isn't there any way to map the tablenames to shorter and more descriptive propertyNames in the model ? something like

var Employee = sql.define('Employee', {
    id : {type : Sequelize.INTEGER , primaryKey: true, map : "veryLongNameForJustTheId"}
},{
     tableName: 'cumbersomeTableName',
     timestamps: false
});;

推荐答案

id : {
    field: 'some_long_name_that_is_terrible_thanks_dba_guy',
    type : Sequelize.INTEGER ,
    primaryKey: true
}

指定一个字段"属性...像这样^

Specify a 'field' attribute ... Like that ^

这篇关于没有选项来映射sequelize模型中的列名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆