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
  • 12,144
  • 3
  • 33
  • 52
Abhishek Goel
  • 15,517
  • 8
  • 81
  • 62

1 Answers1

62

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,751
  • 15
  • 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? – T_Conroy 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