feat: init db module with schema, seed and migration

This commit is contained in:
2026-08-15 15:15:04 +00:00
parent 2fc7f9903b
commit bb722db96e
3 changed files with 37 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
import sqlite3
import os
DB_PATH = 'app.db'
def migrate():
conn = sqlite3.connect(DB_PATH)
cursor = conn.cursor()
with open('schema.sql', 'r') as f:
cursor.executescript(f.read())
with open('seed.sql', 'r') as f:
cursor.executescript(f.read())
conn.commit()
conn.close()
print(f"Database migrated: {DB_PATH}")
if __name__ == '__main__':
migrate()