Fix init crashing if db parent directory does not exist
The init command now correctly creates the parent directory of the database file. Fixes #1.
This commit is contained in:
@@ -113,6 +113,8 @@ def db_command(args, settings):
|
|||||||
def db_init_command(args, settings):
|
def db_init_command(args, settings):
|
||||||
from mft.database import get_db, db_init, SchemaError
|
from mft.database import get_db, db_init, SchemaError
|
||||||
|
|
||||||
|
settings.database_path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
with get_db() as conn:
|
with get_db() as conn:
|
||||||
try:
|
try:
|
||||||
db_init(conn)
|
db_init(conn)
|
||||||
|
|||||||
Reference in New Issue
Block a user