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

moving model.associate outside classMethods due to sequelize@4.0.0 #470

Closed
wants to merge 2 commits into from

Conversation

geluso
Copy link

@geluso geluso commented Jun 16, 2017

I'm trying to figure out if sequelize-cli is supposed to match breaking changes introduced in sequelize@4.0.0. If yes, the model.associate method needs to be moved outside classMethods because classMethods was removed in sequelize@4.0.0.

Review my comment here: #468

@wayne-o
Copy link

wayne-o commented Jul 17, 2017

This desperately needs to be merged in :/

@sushantdhiman
Copy link
Contributor

This will be a breaking change, so can't release to v3

@sushantdhiman sushantdhiman added this to the v4.0.0 milestone Jul 23, 2017
@wayne-o
Copy link

wayne-o commented Jul 23, 2017

I figured out the modification that needs to happen - all good in the interim :)

@sushantdhiman
Copy link
Contributor

I will post sample from v4 upgrade guide for others
http://docs.sequelizejs.com/manual/tutorial/upgrade-to-v4.html

Previous :

const Model = sequelize.define('Model', {
    ...
}, {
    classMethods: {
        associate: function (model) {...}
    },
    instanceMethods: {
        someMethod: function () { ...}
    }
});

New :

const Model = sequelize.define('Model', {
    ...
});

// Class Method
Model.associate = function (models) {
    ...associate the models
};

// Instance Method
Model.prototype.someMethod = function () {..}

@sushantdhiman sushantdhiman mentioned this pull request Jul 23, 2017
21 tasks
@geluso
Copy link
Author

geluso commented Jul 24, 2017

@sushantdhiman thank you for a direct clarifying response and clear progress forward!

@mandreko
Copy link

I'm all for this change. I just spent an evening trying to figure out why my models and relationships were not working. I eventually compared the generated code from the cli to the example site to see the difference in the models.

@buddylindsey
Copy link
Contributor

@sushantdhiman What would it take to get this merged? If @geluso doesn't want to fix the merge conflict could I branch off of his and fix it and create a new PR? Or if @geluso does fix the merge conflict is that all it would take to merge?

Was wanting to see if I could help a bit move cli v4 along.

@sushantdhiman
Copy link
Contributor

@buddylindsey Please open a new branch and I will merge it, I am unable to find some time to complete #441 so let's fix incompatibilities first then think about other features

codetriage-readme-bot pushed a commit to codetriage-readme-bot/cli that referenced this pull request Jun 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
v4.0.0
Backlog
Development

Successfully merging this pull request may close these issues.

None yet

5 participants