在MySQL中使用Loopback(nodejs)。
我想更改型号名称/表名称。 (不同的名称)
我不想看到表名(在API URL中)
table name = 'super_member'
model name = 'member'
api url = '/api/member/';
我该怎么办?
答案 0 :(得分:1)
您可以通过在模型和/或属性上添加mysql
属性来自定义模型:
{
"name": "yourModelName",
"base": "PersistedModel",
"idInjection": false,
"mysql": {
"schema": "YOUR DATABASE NAME",
"table": "YOUR MYSQL TABLE NAME"
},
"properties": {
"PropertyOne": {
"type": "Number"
"required": true,
"mysql": {
"columnName": "YOUR MYSQL COLUMN NAME",
"dataType": "int",
"dataLength": null,
"dataPrecision": 10,
"dataScale": 0,
"nullable": "N"
},
"_selectable": false
}
},
"validations": [],
"relations": {},
"acls": [],
"methods": {}
}