2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-11 15:51:03 +00:00

fix backup in v4 to v5 upgrade

This commit is contained in:
Pratik Vyas 2015-04-02 16:14:53 +05:30
parent ae6d4eee99
commit 2d3ed01a2a
2 changed files with 10 additions and 5 deletions

View File

@ -232,11 +232,14 @@ def update(pull=False, patch=False, build=False, bench=False, auto=False, restar
if pull:
pull_all_apps()
if requirements:
update_requirements()
if upgrade:
pre_upgrade(version_upgrade[0], version_upgrade[1])
import utils, app
reload(utils)
reload(app)
if requirements:
update_requirements()
if patch:
if not no_backup:

View File

@ -314,7 +314,7 @@ def backup_site(site, bench='.'):
exec_cmd("{frappe} --backup {site}".format(frappe=get_frappe(bench=bench), site=site),
cwd=os.path.join(bench, 'sites'))
else:
run_frappe_cmd('--site {site} backup'.format(site=site), bench=bench)
run_frappe_cmd('--site', site, 'backup', bench=bench)
def backup_all_sites(bench='.'):
for site in get_sites(bench=bench):
@ -429,14 +429,16 @@ def run_frappe_cmd(*args, **kwargs):
def pre_upgrade(from_ver, to_ver, bench='.'):
from .migrate_to_v5 import validate_v4, remove_shopping_cart
pip = os.path.join(bench, 'env', 'bin', 'pip')
if from_ver == 4 and to_ver == 5:
apps = ('frappe', 'erpnext')
remove_shopping_cart(bench=bench)
for app in apps:
cwd = os.path.join(bench, 'apps', app)
cwd = os.path.abspath(os.path.join(bench, 'apps', app))
if os.path.exists(cwd):
exec_cmd("git clean -dxf", cwd=cwd)
exec_cmd("{pip} install --upgrade -e {app}".format(pip=pip, app=cwd))
def post_upgrade(from_ver, to_ver, bench='.'):
from .app import get_current_frappe_version