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

Extend model is not supported? #74

Closed
hiradimir opened this issue Jul 29, 2017 · 4 comments
Closed

Extend model is not supported? #74

hiradimir opened this issue Jul 29, 2017 · 4 comments
Assignees
Labels

Comments

@hiradimir
Copy link
Contributor

I want to extend model.

I need field of createAt/updatedAt/deletedAt to all model.
I am trying some case of extends models.
Some case looks like works well.
https://circleci.com/gh/hiradimir/sequelize-typescript-extends-belongTo/4

image

But, some case does not working.

ex) Having HasMany fields extends class contains belongTo,

https://github.com/hiradimir/sequelize-typescript-extends-belongTo/tree/master/src/ts/main/models

https://circleci.com/gh/hiradimir/sequelize-typescript-extends-belongTo/5
Please see yarn test section.

  1) util model test sync:
     Error: Foreign key for "Player" is missing on "Player".
      at Object.getForeignKey (node_modules/sequelize-typescript/lib/services/association.js:74:11)
      at node_modules/sequelize-typescript/lib/models/BaseSequelize.js:72:74
      at Array.forEach (native)
      at node_modules/sequelize-typescript/lib/models/BaseSequelize.js:71:26
      at Array.forEach (native)
      at Sequelize.BaseSequelize.associateModels (node_modules/sequelize-typescript/lib/models/BaseSequelize.js:67:16)
      at Sequelize.BaseSequelize.addModels (node_modules/sequelize-typescript/lib/models/BaseSequelize.js:54:14)
      at Sequelize.BaseSequelize.init (node_modules/sequelize-typescript/lib/models/BaseSequelize.js:60:18)
      at new Sequelize (node_modules/sequelize-typescript/lib/models/v4/Sequelize.js:26:14)
      at Context.it (src/ts/spec/models.spec.ts:10:31)
@RobinBuschmann
Copy link
Member

@hiradimir, I investigated this. It is a bug, unfortunately. Thanks for reporting.

I cannot think of any workaround currently. Sry

@RobinBuschmann RobinBuschmann self-assigned this Jul 30, 2017
@hiradimir
Copy link
Contributor Author

@RobinBuschmann Thank you for reply.
Now, I do not use extends model.


And now, I am analyzing sequelize-typescript, but it is difficult for me...

@RobinBuschmann
Copy link
Member

@hiradimir Regarding this issue, I'am already fixing it.

For any further help I'm happy, too. If you have questions, don't hesitate to ask.

@hiradimir
Copy link
Contributor Author

@RobinBuschmann Thanks for fix, thanks for comment!

I'll use seqeulize-typescript more!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants