From 3ce3f57fee2d7044e4a3060ab8923d007bfcfade Mon Sep 17 00:00:00 2001 From: Pratik Vyas Date: Sun, 4 Oct 2015 23:24:25 -0700 Subject: [PATCH] randomize dbname if restoring as new site from database dump --- frappe/commands.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/frappe/commands.py b/frappe/commands.py index dfab181d37..d3f1257159 100644 --- a/frappe/commands.py +++ b/frappe/commands.py @@ -126,9 +126,8 @@ def restore(context, sql_file_path, mariadb_root_username=None, mariadb_root_pas site = get_single_site(context) frappe.init(site=site) - if not db_name: - db_name = frappe.conf.db_name - _new_site(db_name, site, mariadb_root_username=mariadb_root_username, mariadb_root_password=mariadb_root_password, admin_password=admin_password, verbose=context.verbose, install_apps=install_app, source_sql=sql_file_path, force=context.force) + db_name = db_name or frappe.conf.db_name or hashlib.sha1(site).hexdigest()[:10] + _new_site(db_name, site, mariadb_root_username=mariadb_root_username, mariadb_root_password=mariadb_root_password, admin_password=admin_password, verbose=context.verbose, install_apps=install_app, source_sql=sql_file_path, force=context.force) @click.command('reinstall') @pass_context