Fix database migration and path issues

generated with BackendIM... (backend.im)
This commit is contained in:
Automated Action 2025-05-13 16:01:34 +00:00
parent cd7c0162fe
commit b2cf3ca746
3 changed files with 8 additions and 2 deletions

View File

@ -36,7 +36,7 @@ script_location = alembic
# output_encoding = utf-8
# SQLite URL example
sqlalchemy.url = sqlite:////app/storage/db/db.sqlite
sqlalchemy.url = sqlite:////projects/genericrestapiservice-w6od1p/db.sqlite
[post_write_hooks]
# post_write_hooks defines scripts or Python functions that are run

View File

@ -1,4 +1,10 @@
from logging.config import fileConfig
import sys
import os
from pathlib import Path
# Add the project root directory to Python's path
sys.path.insert(0, str(Path(__file__).parent.parent))
from sqlalchemy import engine_from_config
from sqlalchemy import pool

View File

@ -4,7 +4,7 @@ from sqlalchemy.orm import sessionmaker
from pathlib import Path
# Create the database directory if it doesn't exist
DB_DIR = Path("/app") / "storage" / "db"
DB_DIR = Path("/projects/genericrestapiservice-w6od1p")
DB_DIR.mkdir(parents=True, exist_ok=True)
# Define the SQLite URL