🚚 Refactor and simplify backend file structure (#609)
This commit is contained in:

committed by
GitHub

parent
a065f9c9e8
commit
73b2884057
24
src/backend/app/initial_data.py
Normal file
24
src/backend/app/initial_data.py
Normal file
@@ -0,0 +1,24 @@
|
||||
import logging
|
||||
|
||||
from sqlmodel import Session
|
||||
|
||||
from app.db.engine import engine
|
||||
from app.db.init_db import init_db
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def init() -> None:
|
||||
with Session(engine) as session:
|
||||
init_db(session)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
logger.info("Creating initial data")
|
||||
init()
|
||||
logger.info("Initial data created")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Reference in New Issue
Block a user