From 43e2d88ffebc9704b3bd726ba2b4d7c9850f7e2f Mon Sep 17 00:00:00 2001 From: mohamad Date: Sun, 1 Jun 2025 17:13:09 +0200 Subject: [PATCH] fix: Update Alembic configuration to use absolute paths for ini file and script location in migration process --- be/app/main.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/be/app/main.py b/be/app/main.py index 3ce41c2..ea2c26b 100644 --- a/be/app/main.py +++ b/be/app/main.py @@ -218,12 +218,13 @@ async def run_migrations(): """Run database migrations.""" try: logger.info("Running database migrations...") - # Get the path to the alembic.ini file - alembic_ini_path = os.path.join(os.path.dirname(__file__), '..', 'alembic.ini') + # Get the absolute path to the alembic.ini file + base_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + alembic_ini_path = os.path.join(base_path, 'alembic.ini') alembic_cfg = Config(alembic_ini_path) # Set the script_location to the absolute path - script_location = os.path.join(os.path.dirname(__file__), '..', 'alembic') + script_location = os.path.join(base_path, 'alembic') alembic_cfg.set_main_option('script_location', script_location) # Set the sqlalchemy.url