14 lines
437 B
Python
14 lines
437 B
Python
"""Small script to create the database if it doesn't already exist."""
|
|
|
|
import sqlite3
|
|
from pathlib import Path
|
|
|
|
if not Path("database/dakiny.db").exists():
|
|
with sqlite3.connect("database/dakiny.db") as con:
|
|
cur = con.cursor()
|
|
|
|
with Path("database_setup/database.sql", encoding="utf-8").open() as file:
|
|
database_script = file.read()
|
|
cur.executescript(database_script)
|
|
con.commit()
|