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

Database First #15

Open
whitneyland opened this issue Dec 7, 2011 · 1 comment
Open

Database First #15

whitneyland opened this issue Dec 7, 2011 · 1 comment

Comments

@whitneyland
Copy link

Salut Xavier –

Have you ever considered a feature that would generate the javascript necessary to define joli models by reading an existing database?

So for example a utility could exists that takes as input a SQLite database file, and generates the model definitions by emitting javascript, which could then be used by joli.

This is sometimes referred to in the ORM world as a “database first” approach.

The advantage of this approach would be there is no need to manually define models for databases which already exist.

I am interested in your opinion on the feasibility of this approach with joli.

Regards,
Lee

@xavierlacot
Copy link
Owner

Hi WhitneyLand,

Sorry for the delay, I've been rather busy on other topics lately. I have pushed yesterday a new version of joli.js, which allows to embed a pre-existing database. It won't retro-engeneer the database (so you still have to write the definition of the models), but it allows to open a database bundled in your app.

As for a utility which would help converting an existing database into the joli.js model definition file, taht would be a great idea, and actually not complicated to achieve - just a matter of introspecting the database and generate a model object for each of the tables. I don't know if you have gone ahead with this idea during the last few months. If it is the case, you 'are welcome to share your code :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants