nextcloud: Don't fail uninstall if DB or user don't not exist

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2024-04-01 18:24:06 -07:00 committed by James Valleroy
parent da3f498609
commit c38814b1bc
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -295,8 +295,8 @@ def uninstall():
def _drop_database():
"""Drop the mysql database that was created during install."""
with action_utils.service_ensure_running('mysql'):
query = f'''DROP DATABASE {DB_NAME};
DROP User '{DB_USER}'@'localhost';'''
query = f'''DROP DATABASE IF EXISTS {DB_NAME};
DROP USER IF EXISTS '{DB_USER}'@'localhost';'''
subprocess.run(['mysql', '--user', 'root'], input=query.encode(),
check=True)