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.

Jordan Kasper
  • 13,153
  • 3
  • 36
  • 55
Abhishek Goel
  • 18,785
  • 11
  • 87
  • 65

1 Answers1

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.

superkhau
  • 2,781
  • 18
  • 9
  • 2
    Also delete references of relation in other models if relation created. – achintverma Dec 14 '15 at 23:42
  • hi @superkhau -- 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? – tdc Jan 13 '16 at 17:02
  • No, that should be it. Maybe delete your browser cache? – superkhau Jan 18 '16 at 01:06
  • with apiconnect, we now have some YAML (why not .json, idk). So I assume we need to edit that YAML too, now? – Alexander Mills Sep 29 '16 at 21:14
  • I hope the loopback team adds this action to their CLI – Samih A Jun 24 '18 at 11:51