mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
Add recommended dialects to databases string
This commit is contained in:
parent
48f8eeb20d
commit
ebe3ed5745
1 changed files with 5 additions and 1 deletions
|
|
@ -54,7 +54,7 @@ install_as_MySQLdb()
|
|||
|
||||
|
||||
class Database:
|
||||
DB_STRING_RX = re_compile(r"^(?P<database>(mariadb|mysql)(\+pymysql)?|sqlite(\+pysqlite)?|postgresql):/+(?P<path>/[^\s]+)")
|
||||
DB_STRING_RX = re_compile(r"^(?P<database>(mariadb|mysql)(\+pymysql)?|sqlite(\+pysqlite)?|postgresql(\+psycopg)?):/+(?P<path>/[^\s]+)")
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
|
@ -85,6 +85,10 @@ class Database:
|
|||
sleep(1)
|
||||
else:
|
||||
db_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
elif match.group("database").startswith("m") and not match.group("database").endswith("+pymysql"):
|
||||
sqlalchemy_string = sqlalchemy_string.replace(match.group("database"), f"{match.group('database')}+pymysql") # ? This is mandatory for alemic to work with mariadb and mysql
|
||||
elif match.group("database").startswith("postgresql") and not match.group("database").endswith("+psycopg"):
|
||||
sqlalchemy_string = sqlalchemy_string.replace(match.group("database"), f"{match.group('database')}+psycopg") # ? This is strongly recommended as psycopg is the new way to connect to postgresql
|
||||
|
||||
self.database_uri = sqlalchemy_string
|
||||
error = False
|
||||
|
|
|
|||
Loading…
Reference in a new issue