14 lines
424 B
Python
14 lines
424 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("dakiny_bot/database/database.sql").open() as file:
|
|
database_script = file.read()
|
|
cur.executescript(database_script)
|
|
con.commit()
|