Fix database migration and path issues
generated with BackendIM... (backend.im)
This commit is contained in:
parent
cd7c0162fe
commit
b2cf3ca746
@ -36,7 +36,7 @@ script_location = alembic
|
|||||||
# output_encoding = utf-8
|
# output_encoding = utf-8
|
||||||
|
|
||||||
# SQLite URL example
|
# 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]
|
||||||
# post_write_hooks defines scripts or Python functions that are run
|
# post_write_hooks defines scripts or Python functions that are run
|
||||||
|
@ -1,4 +1,10 @@
|
|||||||
from logging.config import fileConfig
|
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 engine_from_config
|
||||||
from sqlalchemy import pool
|
from sqlalchemy import pool
|
||||||
|
@ -4,7 +4,7 @@ from sqlalchemy.orm import sessionmaker
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
# Create the database directory if it doesn't exist
|
# 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)
|
DB_DIR.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
# Define the SQLite URL
|
# Define the SQLite URL
|
||||||
|
Loading…
x
Reference in New Issue
Block a user