Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

automatic model creation #36

Open
reidlai opened this issue Nov 4, 2016 · 3 comments
Open

automatic model creation #36

reidlai opened this issue Nov 4, 2016 · 3 comments
Labels

Comments

@reidlai
Copy link

reidlai commented Nov 4, 2016

In order to avoid JSON circular reference error when model not found in ArangoDB (see issue 29 below), automatic model creation option should be implemented. This feature can also simplify agile development for fast prototyping.

#29

@reidlai reidlai changed the title New Feature: automatic model creation if not yet defined in ArangoDB New Feature: automatic model creation Nov 4, 2016
@mrbatista
Copy link
Owner

Please add step to reproduce the issue. Thanks.

@smyth64
Copy link

smyth64 commented Dec 12, 2016

@mrbatista
I think he is talking about this issue, e.g.:

In Loopback I have a "Topic" Model.
In ArangoDB the "Topic" Collection is missing.

Now we get this "JSON circular reference error" when trying to query a topic.

An Auto-Creation of the collections ("if collection not exists, then create collection") would be very helpful :)

@smyth64
Copy link

smyth64 commented Dec 13, 2016

@mrbatista The automatic model creation is already implemented. So this issue can be closed.
@reidlai I know what your problem is and here is the solution:

Just create a file in database/migrate.js with this content:

var app = require('../server/server');
 
var ds = app.dataSources.arangodb;

ds.automigrate(function() {
  console.log("migrated everything, yeah!")
})

Every connector has a automigrate function which you can call with this command.

Just run it with node database/migrate.js and there you go!

@mrbatista mrbatista changed the title New Feature: automatic model creation automatic model creation Nov 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants