Migration Discussion

and referring comments:

[quote=“pdvyas”]
Question is better suited for discuss.frappe.io but a quick answer,You can
export a list of names of documents from both the systems and compare.[/quote]

@pdvyas generally the procedure I follow to take copy of db for testing:

On Production Machine:

$ mysqldump -u root -p my-frappe > my-frappe.sql

I move this my-frappe.sql file on testing machine,

On Testing machine:

  1. Drop any database named my-frappe
  2. create new db “my-frappe” on testing machine
$ mysql -u root -p my-frappe < my-frappe.sql

all files in frappe_bench_dir/sites/mysite on both machines are same

and then test Upgrading / Migrating on testing machine.
Is this right way?

If you are using the bench, it will automatically create a backup before you do bench update

Are you still getting the same error for Item?

I’m getting the error

revant@revant-laptop:~/frappe-bench$ bench switch-to-develop
Switched to branch 'develop'
Your branch is behind 'upstream/develop' by 16 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)
remote: Counting objects: 68, done.
remote: Compressing objects: 100% (53/53), done.
remote: Total 68 (delta 56), reused 27 (delta 15), pack-reused 0
Unpacking objects: 100% (68/68), done.
From https://github.com/frappe/erpnext
   2182cd5..ddaedef  develop    -> upstream/develop
   5ecceb5..1b26c6f  v4.x.x     -> upstream/v4.x.x
 * [new tag]         v4.25.0    -> v4.25.0
Switched to branch 'develop'
Your branch is behind 'upstream/develop' by 15 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)
Switched to branch 'develop'
Your branch is up-to-date with 'upstream/develop'.

Switched to develop
Please run `bench update --patch` to be safe from any differences in database schema
revant@revant-laptop:~/frappe-bench$ bench update --upgrade
Already up-to-date.
From https://github.com/frappe/shopping-cart
 * branch            develop    -> FETCH_HEAD
Already up-to-date.
From https://github.com/revant/civil_contracting
 * branch            master     -> FETCH_HEAD
Already up-to-date.
From https://github.com/frappe/frappe
 * branch            develop    -> FETCH_HEAD
Updating 28693f8..4c55d3e
Fast-forward
 frappe/__init__.py                                          |  13 ++++++++++++-
 frappe/commands.py                                          |  46 ++++++++++++++++++++++++++++++++++++++++++++++
 frappe/core/page/desktop/desktop.js                         |   2 +-
 frappe/desk/page/messages/messages.js                       |   5 +++++
 frappe/public/css/tree_grid.css                             |   5 +++--
 frappe/public/images/favicon.ico                            | Bin 198 -> 0 bytes
 frappe/public/images/favicon.png                            | Bin 0 -> 1286 bytes
 frappe/public/images/splash.png                             | Bin 0 -> 33041 bytes
 frappe/public/js/frappe/desk.js                             |  27 ++++++++++-----------------
 frappe/public/js/frappe/form/toolbar.js                     |   2 +-
 frappe/public/js/frappe/misc/utils.js                       |  38 ++++++++++++++++++++++++++++++++++++++
 frappe/public/js/frappe/model/model.js                      |   6 ++++--
 frappe/public/js/frappe/router.js                           |   4 ++--
 frappe/public/js/frappe/ui/listing.js                       |   2 +-
 frappe/public/js/frappe/ui/messages.js                      |   1 +
 frappe/public/js/frappe/ui/page.js                          |   2 +-
 frappe/public/js/frappe/ui/toolbar/about.js                 |   2 +-
 frappe/public/js/legacy/dom.js                              |   3 ---
 frappe/public/js/legacy/form.js                             |   2 +-
 frappe/templates/base.html                                  |   4 ++--
 frappe/templates/pages/desk.html                            |   8 +++++---
 frappe/tests/test_scheduler.py                              |  45 +++++++++++++++++++++++++++++++++++++++++++++
 frappe/utils/scheduler.py                                   |  40 ++++++++++++++++++++++++++++++++--------
 frappe/website/doctype/website_settings/website_settings.py |   9 +++++----
 24 files changed, 216 insertions(+), 50 deletions(-)
 delete mode 100644 frappe/public/images/favicon.ico
 create mode 100644 frappe/public/images/favicon.png
 create mode 100644 frappe/public/images/splash.png
 create mode 100644 frappe/tests/test_scheduler.py
From https://github.com/frappe/erpnext
 * branch            develop    -> FETCH_HEAD
Updating a7b7e62..ddaedef
Fast-forward
 erpnext/accounts/doctype/journal_entry/journal_entry.js                                    |  59 ++++++++++++++++++------------------
 erpnext/accounts/doctype/journal_entry/journal_entry.py                                    |   4 ++-
 .../doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.json       |  15 ++++++++-
 erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.js                   |   1 +
 erpnext/controllers/queries.py                                                             |   2 ++
 erpnext/controllers/taxes_and_totals.py                                                    |   2 +-
 erpnext/hooks.py                                                                           |   6 ++++
 erpnext/patches.txt                                                                        |   1 +
 erpnext/public/images/favicon.ico                                                          | Bin 1150 -> 0 bytes
 erpnext/public/images/favicon.png                                                          | Bin 0 -> 4026 bytes
 erpnext/public/images/splash.png                                                           | Bin 0 -> 16595 bytes
 erpnext/setup/doctype/backup_manager/backup_dropbox.py                                     |  27 ++++++++++-------
 erpnext/setup/doctype/company/company.js                                                   |  43 +++++++++++++++++++++++---
 erpnext/setup/doctype/company/company.json                                                 |  11 +++++--
 erpnext/setup/doctype/company/company.py                                                   |  29 ------------------
 erpnext/setup/doctype/company/delete_company.py                                            |  74 +++++++++++++++++++++++++++++++++++++++++++++
 erpnext/setup/doctype/item_group/item_group.py                                             |   5 ++-
 erpnext/stock/doctype/price_list/price_list.json                                           |   5 +--
 18 files changed, 201 insertions(+), 83 deletions(-)
 delete mode 100644 erpnext/public/images/favicon.ico
 create mode 100644 erpnext/public/images/favicon.png
 create mode 100644 erpnext/public/images/splash.png
 create mode 100644 erpnext/setup/doctype/company/delete_company.py
Migrating castlecraft.in
Executing frappe.patches.v5_0.convert_to_barracuda_and_utf8mb4 in castlecraft.in (cpes-frappe)
Success
Executing execute:frappe.reload_doc('core', 'doctype', 'docfield', force=True) #2015-01-01 in castlecraft.in (cpes-frappe)
Success
Executing execute:frappe.reload_doc('email', 'doctype', 'email_alert') #2014-07-15 in castlecraft.in (cpes-frappe)
Success
Executing execute:frappe.reload_doc('desk', 'doctype', 'todo') #2014-12-31-1 in castlecraft.in (cpes-frappe)
Success
Executing execute:frappe.reload_doc('custom', 'doctype', 'property_setter') #2014-12-31-1 in castlecraft.in (cpes-frappe)
Success
Executing frappe.patches.v5_0.v4_to_v5 in castlecraft.in (cpes-frappe)
Success
Executing frappe.patches.v5_0.remove_shopping_cart_app in castlecraft.in (cpes-frappe)
Success
Executing execute:frappe.permissions.reset_perms("Module Def") in castlecraft.in (cpes-frappe)
Success
Executing execute:frappe.permissions.reset_perms("User") #2015-03-24 in castlecraft.in (cpes-frappe)
Success
Executing frappe.patches.v5_0.rename_table_fieldnames in castlecraft.in (cpes-frappe)
Success
Executing frappe.patches.v5_0.communication_parent in castlecraft.in (cpes-frappe)
Success
Executing frappe.patches.v5_0.clear_website_group_and_notifications in castlecraft.in (cpes-frappe)
Success
Executing execute:frappe.db.sql("""update tabComment set comment = substr(comment, 6, locate(":", comment)-6) where comment_type in ("Assigned", "Assignment Completed")""") in castlecraft.in (cpes-frappe)
Success
Executing frappe.patches.v5_0.fix_feed in castlecraft.in (cpes-frappe)
Success
Executing frappe.patches.v5_0.update_shared in castlecraft.in (cpes-frappe)
Success
Executing frappe.patches.v5_0.bookmarks_to_stars in castlecraft.in (cpes-frappe)
Success
Executing frappe.patches.v5_0.style_settings_to_website_theme in castlecraft.in (cpes-frappe)
Success
Executing frappe.patches.v5_0.rename_ref_type_fieldnames in castlecraft.in (cpes-frappe)
Success
Executing frappe.patches.v5_0.fix_email_alert in castlecraft.in (cpes-frappe)
Success
Executing frappe.patches.v5_0.fix_null_date_datetime in castlecraft.in (cpes-frappe)
Success
Executing frappe.patches.v5_0.force_sync_website in castlecraft.in (cpes-frappe)
Success
Executing execute:frappe.delete_doc("DocType", "Tag") in castlecraft.in (cpes-frappe)
Success
Executing execute:frappe.permissions.reset_perms("GL Entry") #2014-06-09 in castlecraft.in (cpes-frappe)
Success
Executing execute:frappe.permissions.reset_perms("Stock Ledger Entry") #2014-06-09 in castlecraft.in (cpes-frappe)
Success
Executing execute:frappe.rename_doc("DocType", "Support Ticket", "Issue", force=True) in castlecraft.in (cpes-frappe)
Success
Executing erpnext.patches.v4_4.make_email_accounts in castlecraft.in (cpes-frappe)
Success
Executing erpnext.patches.v4_2.reset_bom_costs in castlecraft.in (cpes-frappe)
Success
Executing erpnext.patches.v5_0.update_frozen_accounts_permission_role in castlecraft.in (cpes-frappe)
Success
Executing erpnext.patches.v5_0.update_dn_against_doc_fields in castlecraft.in (cpes-frappe)
Success
Executing execute:frappe.db.sql("update `tabMaterial Request` set material_request_type = 'Material Transfer' where material_request_type = 'Transfer'") in castlecraft.in (cpes-frappe)
Success
Executing execute:frappe.reload_doc('stock', 'doctype', 'item') in castlecraft.in (cpes-frappe)
Success
Executing execute:frappe.db.sql("update `tabItem` i set apply_warehouse_wise_reorder_level=1, re_order_level=0, re_order_qty=0 where exists(select name from `tabItem Reorder` where parent=i.name)") in castlecraft.in (cpes-frappe)
Success
Executing erpnext.patches.v5_0.set_default_company_in_bom in castlecraft.in (cpes-frappe)
Success
Executing erpnext.patches.v5_0.capacity_planning in castlecraft.in (cpes-frappe)
Success
Executing execute:frappe.reload_doc('crm', 'doctype', 'lead') in castlecraft.in (cpes-frappe)
Success
Executing execute:frappe.reload_doc('crm', 'doctype', 'opportunity') in castlecraft.in (cpes-frappe)
Success
Executing erpnext.patches.v5_0.rename_table_fieldnames in castlecraft.in (cpes-frappe)
Success
Executing execute:frappe.db.sql("update `tabJournal Entry` set voucher_type='Journal Entry' where ifnull(voucher_type, '')=''") in castlecraft.in (cpes-frappe)
Success
Executing erpnext.patches.v4_2.party_model in castlecraft.in (cpes-frappe)
Success
Executing erpnext.patches.v5_0.party_model_patch_fix in castlecraft.in (cpes-frappe)
Success
Executing erpnext.patches.v5_0.recalculate_total_amount_in_jv in castlecraft.in (cpes-frappe)
Success
Executing erpnext.patches.v5_0.update_companywise_payment_account in castlecraft.in (cpes-frappe)
Success
Executing erpnext.patches.v5_0.remove_birthday_events in castlecraft.in (cpes-frappe)
Success
Executing erpnext.patches.v5_0.update_item_name_in_bom in castlecraft.in (cpes-frappe)
Success
Executing erpnext.patches.v5_0.rename_customer_issue in castlecraft.in (cpes-frappe)
Success
Executing erpnext.patches.v5_0.rename_total_fields in castlecraft.in (cpes-frappe)
Success
Executing erpnext.patches.v5_0.new_crm_module in castlecraft.in (cpes-frappe)
Success
Executing erpnext.patches.v5_0.update_material_transfer_for_manufacture in castlecraft.in (cpes-frappe)
Success
Executing execute:frappe.reload_doc('crm', 'doctype', 'opportunity_item') in castlecraft.in (cpes-frappe)
Success
Executing erpnext.patches.v5_0.update_item_description_and_image in castlecraft.in (cpes-frappe)
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/revant/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 77, in <module>
    main()
  File "/home/revant/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 14, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/revant/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 664, in __call__
    return self.main(*args, **kwargs)
  File "/home/revant/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 644, in main
    rv = self.invoke(ctx)
  File "/home/revant/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 991, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/revant/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 991, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/revant/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 837, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/revant/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "/home/revant/frappe-bench/apps/frappe/frappe/commands.py", line 28, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/revant/frappe-bench/apps/frappe/frappe/commands.py", line 202, in migrate
    frappe.modules.patch_handler.run_all()
  File "/home/revant/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 25, in run_all
    if not run_single(patchmodule = patch):
  File "/home/revant/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 52, in run_single
    return execute_patch(patchmodule, method, methodargs)
  File "/home/revant/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 68, in execute_patch
    frappe.get_attr(patchmodule.split()[0] + ".execute")()
  File "/home/revant/frappe-bench/apps/erpnext/erpnext/patches/v5_0/update_item_description_and_image.py", line 33, in execute
    if cstr(d.description) == item_details.get(d.item_code).old_description:
AttributeError: 'NoneType' object has no attribute 'old_description'
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 9, in <module>
    load_entry_point('bench==0.1', 'console_scripts', 'bench')()
  File "/home/revant/bench-repo/bench/cli.py", line 55, in cli
    bench()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 610, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 590, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 936, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 782, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 416, in invoke
    return callback(*args, **kwargs)
  File "/home/revant/bench-repo/bench/cli.py", line 247, in update
    patch_sites()
  File "/home/revant/bench-repo/bench/utils.py", line 118, in patch_sites
    run_frappe_cmd('--site', 'all', 'migrate', bench=bench)
  File "/home/revant/bench-repo/bench/utils.py", line 427, in run_frappe_cmd
    subprocess.check_call((f, '-m', 'frappe.utils.bench_helper', 'frappe') + args, cwd=sites_dir)
  File "/usr/lib/python2.7/subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '('/home/revant/frappe-bench/env/bin/python', '-m', 'frappe.utils.bench_helper', 'frappe', '--site', 'all', 'migrate')' returned non-zero exit status 1
revant@revant-laptop:~/frappe-bench$