strongloop - Loopback: How to change the name of a model? -
i have model name "aaa_bbb", want change name aaa-bbb, know how can achieve that? or can change name directly in model json file? here current model.json file.
{ "name": "aaa_bbb", "base": "persistedmodel", "idinjection": true, "options": { "validateupsert": true }, "properties": { ... }, "acls": [], "methods": [] }
typically there 3 steps:
1 - change model name in server/model-config.js
{ ... "aaa_bbb": { // change "aaa-bbb" "datasource": "db", "public": true } }
2 - change model name in common/models/aaa-bbb.json
:
{ "name": "aaa_bbb", // change "aaa-bbb" "base": "persistedmodel", ... }
3 - change model name in `commmon/models/aaa-bbb.js:
module.exports = function(aaabbb) { // change this... };
...however, in case aaabbb
doesn't change, not need perform step 3. loopback automatically removes _
or -
model name , uppercamelcases model name during scaffolding. means both aaa_bbb
, aaa-bbb
output aaabbb
.
Comments
Post a Comment