Best way to migrate data from V6 to V7

Hey everyone!

Just wanted to get some ideas on what you’d consider the best way to migrate data. I have a fresh instance with V7 on it, working on the little things like time zone, date format etc. What I want to do is migrate the data over, which I can do with the export/import function. The issue is in many of the modules (employee most notably) I have many custom fields which don’t seem to transfer over resulting in loss of data during migration.

I also have lots of records attached like comments/emails, attachments (URLS to Google drive), leave applications and for a few users salary data. I am thinking it may make the most sense to do a database dump from V6, make any modifications which may be necessary then copy that to the V7 database and do it manually to ensure that all the linked records (comments, links, custom fields, etc) all get matched up as expected.

If anyone has a preferred method or suggestions on how to best achieve this data transfer please let me know!

Thank you, and keep it up everyone!

  1. For database you can restore v6 backup then restore it on new instance then run bench migrate
  2. For custom fields, best way to do this is creating custom app then export it as fixtures then install this custom app on v7 instance
  3. For files copy the v6 folder and upload it via ftp into v7 instance. It’s under ~/sites/your_site/public or private folder

Hope it helps

1 Like


To add some details in @jof2jc steps

  • Create a new bench using bench init <new-bench-name>. This will contain latest erpnext and frappe apps.

  • Backup your v6 instance using bench --site <site_name> backup --with-files, this will create a tar copy of private and public files folder in private/backups under your site folder.

  • After copying these files to your new v7 instance you can restore those files using following command bench --site <site_name> restore [--force(optional)] <path/to/database.sql.gz> --with-private-files <path/to/private_files.tar> --with-public-files </path/to/files.tar>

  • This should restore your site, and then execute bench --site <site_name> migrate to update the database and run patches.

All the above steps assume that you are creating a v7 instance on a separate clean instance. In case, you want to perform the activity on the same bench you will have create v7 site with new name or else you will get database already exists error.


@shreyasp @jof2jc Thanks for the replies! Your input is helpful!

Thanks again :smiley:

@shreyasp @jof2jc
Hello Thanks for the guide.
I created new site and deleted the db with mysql command
I tried restore with the command. Restore command was successful. But bench --site (site_name) migrate is throwing error
error here > bench --site 9t9erp migrate Migrating 9t9erpExecuting frappe.patches.v7_0.up -

Any idea about this type of error?