From b36b9c1d6745a44d0eaf7cf14723a3b9c9a328cb Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Mon, 15 Jun 2020 14:28:08 +0530 Subject: [PATCH] feat: add option for no backup in remove app --- frappe/commands/site.py | 5 +++-- frappe/installer.py | 9 +++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/frappe/commands/site.py b/frappe/commands/site.py index 28e61282eb..2df99c2d3e 100755 --- a/frappe/commands/site.py +++ b/frappe/commands/site.py @@ -414,15 +414,16 @@ def remove_from_installed_apps(context, app): @click.argument('app') @click.option('--yes', '-y', help='To bypass confirmation prompt for uninstalling the app', is_flag=True, default=False, multiple=True) @click.option('--dry-run', help='List all doctypes that will be deleted', is_flag=True, default=False) +@click.option('--no-backup', help='Do not backup the site DB', is_flag=True, default=False ) @pass_context -def uninstall(context, app, dry_run=False, yes=False): +def uninstall(context, app, dry_run=False, yes=False, no_backup=False): "Remove app and linked modules from site" from frappe.installer import remove_app for site in context.sites: try: frappe.init(site=site) frappe.connect() - remove_app(app, dry_run, yes) + remove_app(app, dry_run, yes, no_backup) finally: frappe.destroy() if not context.sites: diff --git a/frappe/installer.py b/frappe/installer.py index 03691e1883..b157ec53e5 100755 --- a/frappe/installer.py +++ b/frappe/installer.py @@ -118,7 +118,7 @@ def remove_from_installed_apps(app_name): if frappe.flags.in_install: post_install() -def remove_app(app_name, dry_run=False, yes=False): +def remove_app(app_name, dry_run=False, yes=False, no_backup=False): """Delete app and all linked to the app's module with the app.""" if not dry_run and not yes: @@ -126,9 +126,10 @@ def remove_app(app_name, dry_run=False, yes=False): if confirm!="y": return - from frappe.utils.backups import scheduled_backup - print("Backing up...") - scheduled_backup(ignore_files=True) + if not no_backup: + from frappe.utils.backups import scheduled_backup + print("Backing up...") + scheduled_backup(ignore_files=True) drop_doctypes = []