-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Cyclic dependency checker should consider different 'as' parameter #1717
Comments
This is because dev11 introduces automatic foreign keys on your tables. This means that contentId on version will reference content.id, and content.realeaseVersionId will reference version.id. Since both tables now depend on each other, we cannot create any of them (content must be created before version, and version must be created before content. To fix this problem, you should add |
Thanks for this super fast response time. That solved the problem. |
@janmeier.. can you show how to manually add the keys after |
@asimsohail Add them manually either using phpmyadmin/pgadmin whatever or by writing the query |
@janmeier Couldn't Sequelize first create the tables without the foreign keys, then add all the foreign keys right after? |
@bottleofwater that could work |
Is Table structure:
|
@mickhansen Is this currently in development? |
I know this is an old issue, but why does not |
Yes old issue, but it doesn't appear to work. With above, is this currently available? EDIT: This does kind of work. You just have to do 3 things:
|
@jasonbodily it's |
@gzurbach - Sorry about that! Updated my answer! |
@jasonbodily You have a typo, |
Same problem here. |
Was this ever resolved? |
Aw man and here I thought this was solved... Just ran into this issue, but I have over 15 tables with hasMany relationships :( I will try them without and query right after migration then, but how do I call a migration file to be executed after .sync().then((function{}))? |
Any news on this? :-( |
Can we get this issue reopened so somebody can potentially send a PR for this? |
@sushantdhiman Thanks! |
@sushantdhiman Is this in development now? |
This comment has been minimized.
This comment has been minimized.
Any news? |
@LFabre and others - none that I know of. PR is welcome. |
Any news? :-( |
🎉 This issue has been resolved in version 6.20.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
I'll close. Starting with Sequelize 6.20.0, if there is a cyclic foreign key, |
I have following example:
Which produces following error:
I want to associate the active release of a content by the
Content
model, for this I added a new association that links directly to myVersion
model. The key for this id (ReleaseVersionId) should be in theContent
Table. This key can be null if no version was released. Since Version 2.0.0-dev11 I get an error when constructing something like this. Do I miss something or can I model something like this in a sequelize way?The text was updated successfully, but these errors were encountered: