feat: add ability to run db migrations

This commit is contained in:
Jun Siang Cheah committed 2024-04-01 11:12:46 +01:00
1 parent 196f91d68c
commit 4cb2cc62d2
4 files changed
+175 -1

No files matched your search

+4 -1
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)