Bench Restore Not Working ERPNext 14

I backed up a site and got an SQL file. I then tried restoring it on a fresh site. The command shows some SQL statements (Not all of them), deletes the file and shows it was successful. But when I open the site I get this

The command I ran was bench --site sitename --force restore path-to-sql-file

Am I not supposed to install all apps before running the restore?

This is the error in the traceback
pymysql.err.OperationalError: (1054, "Unknown column 'onboarding_status' in 'field list'")

Basically you previous site were running an older version of frappe and now you are trying to restore your site where a newer frappe version is running. That’s why you are having this error.

Now how you will fix it? First get the version of your previous frappe app using bench version.
Then install the same version of frappe/erpnext/your apps and try to restore it.

Important: Never use --force to restore your site. In most scenarios
you will endup with errors.

If the above doesn’t work, let me know, in that case you may have to opt for manual restore.

1 Like

Yeah we were updating it because of a bug. Both versions were 14 though. How will I do a manual restore?

I have a feeling you are using code from dev branch
instead of version-14.

Before manual update.
run following command in your new site.
bench update --patch

It will apply all necessary patches. However if above doesnt work then move to manual process.

  1. First of all we need to establish, all app versions from
    your previous site.
    you can collect this information from using “bench version”
    command.

  2. Mention the frappe & erpnext version on which you want to migrate. frappe version 14.42.0 if you are using version-branch.

  3. Schema Sync. Database schema of your old site and new site
    should be synced. You can use command line tool like SchemaSync or
    GUI tool DBBeaver, I prefer command line.

  4. Dump data from your old site using mysqldump. Make sure you use
    following code to dump data. --no-create-info is important.
    mysqldump --no-create-info oldsite > dump-data.sql

  5. restore data to that site’s database where you have synced the
    schema in step 3.
    mysql -u root -p database_name < dump_file.sql

  6. your site should work now.

1 Like

Nah I’m using version-14 on both. I’m using a custom container image with frappe docker