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