mirror of
https://github.com/aljazceru/nutshell.git
synced 2026-01-05 18:04:22 +01:00
db fix
This commit is contained in:
17
core/db.py
17
core/db.py
@@ -123,18 +123,13 @@ class Database(Compat):
|
||||
)
|
||||
)
|
||||
else:
|
||||
if os.path.isdir(self.db_location):
|
||||
self.path = os.path.join(self.db_location, f"{self.name}.sqlite3")
|
||||
database_uri = f"sqlite:///{self.path}"
|
||||
self.type = SQLITE
|
||||
else:
|
||||
if not os.path.exists(self.db_location):
|
||||
print(f"Creating database directory: {self.db_location}")
|
||||
if not os.path.exists(self.db_location):
|
||||
os.makedirs(self.db_location)
|
||||
# raise NotADirectoryError(
|
||||
# f"db_location named {self.db_location} was not created"
|
||||
# f" - please 'mkdir {self.db_location}' and try again"
|
||||
# )
|
||||
os.makedirs(self.db_location)
|
||||
self.path = os.path.join(self.db_location, f"{self.name}.sqlite3")
|
||||
database_uri = f"sqlite:///{self.path}"
|
||||
self.type = SQLITE
|
||||
|
||||
self.schema = self.name
|
||||
if self.name.startswith("ext_"):
|
||||
self.schema = self.name[4:]
|
||||
|
||||
Reference in New Issue
Block a user