feat: add ability to run db migrations

This commit is contained in:
Jun Siang Cheah
2024-04-01 11:12:46 +01:00
committed by Timothy J. Baek
parent 7978adbf45
commit 151055590d
4 changed files with 175 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
from peewee import *
from peewee_migrate import Router
from config import SRC_LOG_LEVELS, DATA_DIR
import os
import logging
@@ -16,4 +17,6 @@ else:
DB = SqliteDatabase(f"{DATA_DIR}/webui.db")
DB.connect()
router = Router(DB, migrate_dir="apps/web/internal/migrations", logger=log)
router.run()
DB.connect(reuse_if_open=True)