appsv2: mysqlshow is fucking dumb and returns exit code 0 when DB doesnt exists ...

This commit is contained in:
Alexandre Aubin 2023-02-14 16:09:55 +01:00
parent ab8a6b940f
commit 0ab20b733b

View file

@ -953,7 +953,7 @@ class DatabaseAppResource(AppResource):
def db_exists(self, db_name):
if self.dbtype == "mysql":
return os.system(f"mysqlshow '{db_name}' >/dev/null 2>/dev/null") == 0
return os.system(f"mysqlshow | grep -q -w '{db_name}' 2>/dev/null") == 0
elif self.dbtype == "postgresql":
return (
os.system(