question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't create schema due to cyclic fk references

See original GitHub issue

I have a User model. I want a one to one relation between two users.

spouse = fields.ForeignKeyField('models.User', on_delete=fields.SET_NULL, null=True)

But i get this error:

tortoise.exceptions.ConfigurationError: Can't create schema due to cyclic fk references

Any help?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
harshanarayanacommented, Jul 17, 2019

@grigi I am sorry I haven’t been able to get to this in last two days. I am going to look at this over the weekend and get it done. Sorry for the delay.

0reactions
FIRDOUS-BHATcommented, Jun 7, 2021

Hello there, I’m getting the same error after I removed the foreign key from the model.

Read more comments on GitHub >

github_iconTop Results From Across the Web

tortoise/community - Gitter
ConfigurationError: Can't create schema due to cyclic fk references. Do you know how i can get this sorted out ? And why would...
Read more >
Foreign Key cyclic reference Dilemma - mysql - Stack Overflow
The problem which I am facing here is that this results in a cyclic reference between the users and the workgroups table. Since...
Read more >
Is it acceptable to have circular foreign key references\How to ...
No, it's not acceptable to have circular foreign key references. Not only because it would be impossible to insert data without constantly dropping...
Read more >
How to deal with cyclic foreign keys - Thoughts about SQL
Sometimes cyclic foreign keys can't be avoided, but modern SQL ... alter table department add foreign key (manager_id) references employee; ...
Read more >
MySQL Bugs: #89696: Cyclic dependencies are not resolved ...
Cannot delete or update a parent row: a foreign key constraint fails ... CREATE SCHEMA `cascade`; USE `cascade`; CREATE TABLE table1 ( id ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found