From 5ba5107a3b7a868525b3b20261afe59d85f6102b Mon Sep 17 00:00:00 2001 From: Sami Abuzakuk Date: Tue, 14 Oct 2025 20:26:51 +0200 Subject: [PATCH] Add auto alembic upgrade in container --- alembic.ini => backend/alembic.ini | 0 {alembic => backend/alembic}/env.py | 2 +- {alembic => backend/alembic}/script.py.mako | 0 .../alembic}/versions/9a7bb433ef44_initial_migration.py | 0 backend/requirements.txt | 1 + docker/entry.sh | 1 + 6 files changed, 3 insertions(+), 1 deletion(-) rename alembic.ini => backend/alembic.ini (100%) rename {alembic => backend/alembic}/env.py (98%) rename {alembic => backend/alembic}/script.py.mako (100%) rename {alembic => backend/alembic}/versions/9a7bb433ef44_initial_migration.py (100%) diff --git a/alembic.ini b/backend/alembic.ini similarity index 100% rename from alembic.ini rename to backend/alembic.ini diff --git a/alembic/env.py b/backend/alembic/env.py similarity index 98% rename from alembic/env.py rename to backend/alembic/env.py index 9a8ef82..1a995df 100644 --- a/alembic/env.py +++ b/backend/alembic/env.py @@ -4,7 +4,7 @@ from sqlalchemy import engine_from_config from sqlalchemy import pool from alembic import context -from backend.model import Base +from model import Base # this is the Alembic Config object, which provides # access to the values within the .ini file in use. diff --git a/alembic/script.py.mako b/backend/alembic/script.py.mako similarity index 100% rename from alembic/script.py.mako rename to backend/alembic/script.py.mako diff --git a/alembic/versions/9a7bb433ef44_initial_migration.py b/backend/alembic/versions/9a7bb433ef44_initial_migration.py similarity index 100% rename from alembic/versions/9a7bb433ef44_initial_migration.py rename to backend/alembic/versions/9a7bb433ef44_initial_migration.py diff --git a/backend/requirements.txt b/backend/requirements.txt index 29d0507..eb9046c 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -2,3 +2,4 @@ requests uvicorn fastapi sqlalchemy +alembic diff --git a/docker/entry.sh b/docker/entry.sh index 1a42fc2..18487c7 100644 --- a/docker/entry.sh +++ b/docker/entry.sh @@ -19,6 +19,7 @@ cd ../.. # Start the backend using uvicorn cd backend +alembic upgrade head uvicorn backend:app --host 0.0.0.0 --port 8000 & cd ..