fix: Remove verbose flag and add message for dropping doctype table
This commit is contained in:
parent
07bea9b5c6
commit
ea1c6eae7a
2 changed files with 5 additions and 10 deletions
|
|
@ -444,16 +444,15 @@ def remove_from_installed_apps(context, app):
|
|||
@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', is_flag=True, default=False)
|
||||
@click.option('--force', help='Force remove app from site', is_flag=True, default=False)
|
||||
@click.option('--verbose', help='Add verbosity', is_flag=True, default=False)
|
||||
@pass_context
|
||||
def uninstall(context, app, dry_run, yes, no_backup, force, verbose):
|
||||
def uninstall(context, app, dry_run, yes, no_backup, force):
|
||||
"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_name=app, dry_run=dry_run, yes=yes, no_backup=no_backup, force=force, verbose=context.verbose or verbose)
|
||||
remove_app(app_name=app, dry_run=dry_run, yes=yes, no_backup=no_backup, force=force)
|
||||
finally:
|
||||
frappe.destroy()
|
||||
if not context.sites:
|
||||
|
|
|
|||
|
|
@ -119,7 +119,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, no_backup=False, force=False, verbose=True):
|
||||
def remove_app(app_name, dry_run=False, yes=False, no_backup=False, force=False):
|
||||
"""Remove app and all linked to the app's module with the app from a site."""
|
||||
|
||||
# dont allow uninstall app if not installed unless forced
|
||||
|
|
@ -135,9 +135,6 @@ def remove_app(app_name, dry_run=False, yes=False, no_backup=False, force=False,
|
|||
if not confirm:
|
||||
return
|
||||
|
||||
if dry_run:
|
||||
verbose = True
|
||||
|
||||
if not no_backup:
|
||||
from frappe.utils.backups import scheduled_backup
|
||||
print("Backing up...")
|
||||
|
|
@ -175,13 +172,12 @@ def remove_app(app_name, dry_run=False, yes=False, no_backup=False, force=False,
|
|||
|
||||
if not dry_run:
|
||||
remove_from_installed_apps(app_name)
|
||||
# drop tables after a commit
|
||||
frappe.db.commit()
|
||||
|
||||
for doctype in set(drop_doctypes):
|
||||
print("* dropping Table for '{0}'...".format(doctype))
|
||||
frappe.db.sql("drop table `tab{0}`".format(doctype))
|
||||
|
||||
sys.stdout = sys.__stdout__
|
||||
frappe.db.commit()
|
||||
click.secho("Uninstalled App {0} from Site {1}".format(app_name, frappe.local.site), fg="green")
|
||||
|
||||
frappe.flags.in_uninstall = False
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue