-
Notifications
You must be signed in to change notification settings - Fork 8
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
More control over models synching #13
Comments
Thanks @nathanlepori , have you try to find a workaround? or what can work.. I am bit out of touch with this project so i will have to dig a bit to find solution |
RN I'm trying to see how it can be done here. The problem is that in the original code
This allows a constructor to return a Promise transparently for the user (as in using the constructor's result as a regular promise that returns a class instance) and of course it works with both @pankajvaghela Let me know what do you think and I can implement one of the three options no problem. Edit:
|
@nathanlepori I changed the code to following . and it doesn't break anything... but i am not sure what it will help with?
|
I tried something similar myself and turns out it doesn't really help... Ideally a constructor should only return an instance of the class it is creating, not a promise of said class. Also any promise should be returned to the caller so that any dependent code can be run after the promise resolves. Let me know if it makes sense to you. Sorry if i mixed up other features on my branch but I was more concerned with implementing what I needed for myself. Depending on whether you intend to still depend on sequelize@5 I can rollback those changes and create a PR. |
Right now models are synched in the constructor when using the
sync
option and the promise returned when calling model.sync is ignored. It would be better to have a guard.sync method that accepts the same options as the underlying sequelize method.The text was updated successfully, but these errors were encountered: