Rename database_setup directory to database.

This commit is contained in:
2025-03-03 15:18:31 -05:00
parent 36eae17751
commit f1f0c0c6de
17 changed files with 15 additions and 14 deletions
+15
View File
@@ -0,0 +1,15 @@
"""Simple file to set up the sqlmodel connection to database."""
from sqlmodel import SQLModel, create_engine
from utilities import config
from . import models # noqa: F401 Need this import for creating the models.
if config.ENVIRONMENT == "prod":
url = f"mysql+pymysql://{config.SQL_USER}:{config.SQL_PASS}@{config.SQL_HOST}/{config.SQL_DB}"
else:
url = "sqlite:///database.db"
engine = create_engine(url)
# Don't need to create all when connected to prod.
SQLModel.metadata.create_all(engine)