Destroy a model in loopback.io
Asked Answered
M

1

32

How can I delete a model in strongloop's loopback.io?

I have seen somewhere command called persistedModel.destroy()

but when I exectute slc persistedModel.destroy()

I get command not found error.

Marconigraph answered 14/2, 2015 at 6:8 Comment(2)
Are you trying to delete a model you defined via slc loopback:model or delete an instance of model in your database?Babbette
delete complete model defined via slc loopback:modelMarconigraph
B
63

Delete /common/models/your-model.js and /common/models/your-model.json, then delete the lines referencing your model in /server/model-config.json.

Babbette answered 14/2, 2015 at 18:57 Comment(5)
Also delete references of relation in other models if relation created.Mullein
hi @Babbette -- I've deleted the reference inside of model-config.json, and the model .js and .json files inside server/models (I do not have a /common/models/).. but the deleted model is still appearing in the API explorer. Is there something else I need to do?Drawee
No, that should be it. Maybe delete your browser cache?Babbette
with apiconnect, we now have some YAML (why not .json, idk). So I assume we need to edit that YAML too, now?Jonjona
I hope the loopback team adds this action to their CLISlim

© 2022 - 2024 — McMap. All rights reserved.