mickhansen / graphql-sequelize

GraphQL & Relay for MySQL & Postgres via Sequelize
MIT License
1.9k stars 172 forks source link

Support for Sequelize >=4 #569

Closed flybluewolf closed 6 years ago

flybluewolf commented 6 years ago

upgrade to version 7.0.0, this version don't support Sequelize >=4.

` let toCursor = function toCursor(item, index) {

let id = item.get(item.Model.primaryKeyAttribute);

return (0, _base.base64)(PREFIX + id + SEPERATOR + index);

}; ` it seem to change

` let toCursor = function toCursor(item, index) {

    let id = item.get(targetMaybeThunk.primaryKeyAttribute);

    return (0, _base.base64)(PREFIX + id + SEPERATOR + index);

}; `

mickhansen commented 6 years ago

That fix wouldn't work as it doesnn't take into account the part that says maybeThunk. Maybe item.constructor works, PR welcome (you can test locally against v4)

intellix commented 6 years ago

item.constructor worked for me locally with v4. I'll submit a PR shortly