-
Notifications
You must be signed in to change notification settings - Fork 5
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
Support v5 instance methods on models #1
Comments
I've got a basic version of this running, tested using classes of the form:
The modifications are on this branch - it's pretty rough at the moment, with minimal alterations, but I would be keen to get some feedback before tidying up. Really, it's a bit of a sticking plaster, but it might help gradually migrate to the newer sequelize approach. |
Sorry I didn't see this issue earlier, we are currently doing something similar to philwier posted. We have a couple blog posts that I will prioritize putting up tomorrow to show how we use this in production. In addition, we have a few more updates coming to this now we are working on internally to provide more functionality (such as transaction support) which wasn't in the original sequelize-mock repo and some refactoring to allow it to work. @philtweir we would love a pull request from you to add your work to this project while providing credit to you and will continue to support your changes in the future. I'll update this tomorrow with these updates and a link to how we use it. Edit: for now this is our "base model" which we then extend our actual models from |
Awesome and apologies for the long delay, but great news! |
Hi, I came up to a similar problem and was able to fix it with a 1 liner:
Edit: it needed to be an empty object or else every new model will overwrite the prototype methods |
We were experiencing this when doing deep recursion. now I understand whats happening. Thanks for the insight. If you want to make a pull request to adapt this into the core package I'd love to see it! |
Hope you had a good new year @SippieCup can do! Will link here when done |
Thanks for modernizing sequelize-mock!
sequelize v5 requires that instance methods be on the prototype: https://sequelizedocs.fullstackacademy.com/instance-and-class-methods/ - I'm working on a codebase that needs some love, and I'd be very happy if this were supported :)
The text was updated successfully, but these errors were encountered: