feat: sqlite migration runner with meta version table

This commit is contained in:
Joseph Doherty
2026-04-26 11:32:32 -04:00
parent 01e6975d20
commit 67517926aa
5 changed files with 67 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
from __future__ import annotations
import sqlite3
from contextlib import contextmanager
from pathlib import Path
@contextmanager
def open_db(path: Path):
path.parent.mkdir(parents=True, exist_ok=True)
conn = sqlite3.connect(path)
conn.execute("PRAGMA journal_mode=WAL")
conn.execute("PRAGMA foreign_keys=ON")
try:
yield conn
conn.commit()
finally:
conn.close()