How do I do a migration if my backend container won't start due to an error? #1345
-
First Check
Commit to Help
Example Code
DescriptionI have an error that was caused by some model code. I have updated the models and I want to create a new migration, but the following command fails:
Looking at the logs, it's clear this is caused by my model not having a relationship done properly. Operating SystemmacOS Operating System DetailsMac M1 Python Version3.11.2 Additional ContextNo response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
see here on how to apply migrations |
Beta Was this translation helpful? Give feedback.
-
In
and uncomment the line above
Then run
You are inside the backend container and can run alembic commands |
Beta Was this translation helpful? Give feedback.
In
docker-compose.override.yml
comment out the following linesand uncomment the line above
Then run
docker compose watch
and in new terminal, attach to the container withdocker compose exec backend bash
.Now you can see something like
You are inside the backend container and can run alembic commands
Docs: https://github.com/fastapi/full-stack-fastapi-template/blob/master/backend/README.md#docker-compose-override