Sequelize-typescript: Add support for Sequelize V6

Created on 9 Jul 2019  路  5Comments  路  Source: RobinBuschmann/sequelize-typescript

I'm submitting a ...

[ ] bug report
[x] feature request

Now that Sequelize v6 is out, we should add support

Most helpful comment

@RobinBuschmann I only found these release notes with breaking changes note https://github.com/sequelize/sequelize/releases/tag/v6.0.0%40next

All 5 comments

Hey @thebigredgeek thanks for bringing this up. Can you provide docs (breaking changes) for version 6? I couldn't find any.

@RobinBuschmann I only found these release notes with breaking changes note https://github.com/sequelize/sequelize/releases/tag/v6.0.0%40next

Any updates on this?

As far as I can see it, just hooks won't work anymore if upgrading to sequelize v6. Anything else should still be untouched. But anyway, the only thing that needs to be changed (or better added) is support for the new syntax model.hooks.add:

function installHook(model: typeof Model, hook: HookMeta): void {
+ const addHook = 'addHook' in model 
+  ? (...args: any[]) => model.addHook(...args) 
+  : (...args: any[]) => model.hooks.add(...args);
  if (hook.options && hook.options.name) {
+    addHook(hook.hookType, hook.options.name, model[hook.methodName]);
-    model.addHook(hook.hookType, hook.options.name, model[hook.methodName]);
    return;
  }
+  addHook(hook.hookType, model[hook.methodName]);
-  model.addHook(hook.hookType, model[hook.methodName]);
}

https://github.com/RobinBuschmann/sequelize-typescript/blob/master/src/hooks/shared/hooks-service.ts#L77

Do I've overseen something? Anything else that needs to be adjusted in order to support v6? PR's are welcome ;)

[email protected] has been released and it supports sequelize >= 2.0.0! 馃帀

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oscarcalvo picture oscarcalvo  路  3Comments

josecolella picture josecolella  路  4Comments

fareshan picture fareshan  路  3Comments

lverledens picture lverledens  路  4Comments

bschveitzer picture bschveitzer  路  5Comments