feat: make search indexing optional in migrate

This commit is contained in:
Shivam Mishra 2020-07-21 16:32:54 +05:30
parent 59fe187313
commit 8b7ae16cdd
2 changed files with 6 additions and 6 deletions

View file

@ -274,9 +274,9 @@ def disable_user(context, email):
@click.command('migrate')
@click.option('--rebuild-website', help="Rebuild webpages after migration")
@click.option('--skip-failing', is_flag=True, help="Skip patches that fail to run")
@click.option('--skip-search-index', is_flag=True, help="Skip patches that fail to run")
@click.option('--index-site', is_flag=True, help="Index public web pages")
@pass_context
def migrate(context, rebuild_website=False, skip_failing=False, skip_search_index=False):
def migrate(context, rebuild_website=False, skip_failing=False, index_site=False):
"Run patches, sync schema and rebuild files/translations"
from frappe.migrate import migrate
@ -289,7 +289,7 @@ def migrate(context, rebuild_website=False, skip_failing=False, skip_search_inde
context.verbose,
rebuild_website=rebuild_website,
skip_failing=skip_failing,
skip_search_index=skip_search_index
index_site=index_site
)
finally:
frappe.destroy()

View file

@ -22,7 +22,7 @@ from frappe.core.doctype.scheduled_job_type.scheduled_job_type import sync_jobs
from frappe.search.website_search import build_index_for_all_routes
def migrate(verbose=True, rebuild_website=False, skip_failing=False, skip_search_index=False):
def migrate(verbose=True, rebuild_website=False, skip_failing=False, index_site=False):
'''Migrate all apps to the latest version, will:
- run before migrate hooks
- run patches
@ -89,9 +89,9 @@ Otherwise, check the server logs and ensure that all the required services are r
frappe.get_attr(fn)()
# add static pages to global search
if not skip_search_index:
if index_site:
# Run this last as it updates the current session
full_text_search.build_index_for_all_routes()
build_index_for_all_routes()
frappe.db.commit()