mate.db wird erstellt, wenn nicht existent

This commit is contained in:
2000-Trek 2023-09-20 18:50:35 +02:00
parent f06a78d118
commit bf44885ec9

View file

@ -1,3 +1,4 @@
from re import M
import sqlite3
import click
@ -6,10 +7,17 @@ from flask import current_app, g
def get_db():
if 'db' not in g:
g.db = sqlite3.connect(
current_app.config['DATABASE'],
detect_types=sqlite3.PARSE_DECLTYPES
)
try:
g.db = sqlite3.connect(
current_app.config['DATABASE'],
detect_types=sqlite3.PARSE_DECLTYPES
)
except:
init_db()
g.db = sqlite3.connect(
current_app.config['DATABASE'],
detect_types=sqlite3.PARSE_DECLTYPES
)
g.db.row_factory = sqlite3.Row
return g.db