tortoise / tortoise/tortoise-orm
Foreign Key
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.6k
- Forks
- 516
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 9
Description
Describe the bug
I'm writing api using fastapi, so i create a models folder and add init inside there, another folders that have my classes, so i have this erro when i try to use ForeignKey but when i try migrate with aerich, ,
tortoise.exceptions.ConfigurationError: No model with name xxxxx
To Reproduce
https://i.imgur.com/Xd8mzPs.png
Expected behavior
A clear and concise description of what you expected to happen.
Additional context
Add any other context about the problem here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the models folder and its init file, then review how the ForeignKey reference is registered before Aerich migration runs. Reproduce the ConfigurationError from the reported FastAPI setup and compare the model organization with the migration configuration. Done means the migration recognizes the referenced model without raising the error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fastapi, python
- Domain
- backend, database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100