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

Missing sequelize.sync()? #1

Open
cesardeazevedo opened this issue Jul 30, 2015 · 3 comments
Open

Missing sequelize.sync()? #1

cesardeazevedo opened this issue Jul 30, 2015 · 3 comments

Comments

@cesardeazevedo
Copy link

Thanks for sharing it, i was trying to look for a waterline replacement with sequelize and i found it amazing, nice work.

i've trying run it and i realize that models was not generating and there's no sequelize syncronization in the hook file, and i've fixed adding these lines,

sequelize.sync({ force: true }).then(function() {
    return next();
});

Maybe it should be added? or maybe store a sync property in the config/connections.js

Also, i really would like to move forward with this sequelize approach in production, but the waterline have me saving a lot time with their blueprints, which won't work with sequelize, but maybe it worth to do a fork from blueprints hook implementation to work with sequelize, what do you think?

Thanks in advance.

@festo
Copy link
Owner

festo commented Jul 30, 2015

Thanks, I am very glad that I could help with it.

Yepp, this is a missing part. I totally forgot about it, because I usually use db-migrate to manage the database with SQL files. (I use lot of triggers ... )

I will put these lines into the project and mentioned it in the article too. Thank your help!

The blueprints are much bigger task. For me, it is not necessary right know, so I don't plan to do it, but I think It can be rewrite.

If you disable the original hook in .sailsrc and create your own, it can work, but create some action in your controllers maybe less work than rewrite the hook ...

@cesardeazevedo
Copy link
Author

Thanks for the reply,

i've start a repository to the blueprints implementations which is a basic fork from original blueprints hooks, and it's working, was not that hard, i just have to do a safe coverage testing.
https://github.com/cesardeazevedo/sails-hook-sequelize-blueprints

Should be this hook an installable hook?

@festo
Copy link
Owner

festo commented Jul 31, 2015

Ok, good luck for that! :)

In the following days, I will try to do an installable hook!

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

No branches or pull requests

2 participants