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

How docker postgres creates tables #34

Open
Raghulraviaws opened this issue Mar 5, 2024 · 2 comments
Open

How docker postgres creates tables #34

Raghulraviaws opened this issue Mar 5, 2024 · 2 comments

Comments

@Raghulraviaws
Copy link

We have alembic setup with multiple revisions and we create table using 'alembic upgrade head' when we deploy manually in ubuntu VM.
But when you were showing how to deploy using docker, I see we never use alembic command to create tables. But still postgres works as expected. How is that?

@edoardoascenzi
Copy link

It actually didn't work for me. I had to manually run this command:
docker exec fastapi-api-1 alembic upgrade head
in order to update the tables.

@RobinMessiaen
Copy link

I guess you can replace in the docker-compose.yml file:
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
by
CMD alembic upgrade head && uvicorn app.main:app --host 0.0.0.0 --port 8000

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

No branches or pull requests

3 participants