How to downgrade from erpnext 13.x.x-develop to erpnext 12.14.0?

Hello,

after a lot of headaches, I could finally install ERPNext, but, unfortunately, these versions were installed (under development):

erpnext 13.x.x-develop
frappe 13.x.x-develop

How can I downgrade to these?

erpnext 12.14.0
frappe 12.12.0

I have followed instructions in this site: vultr.com/docs/how-to-install-erpnext-open-source-erp-on-centos-7

I think the problem was that it teaches to use git clone https://github.com/frappe/bench bench-repo, but instructions in this page were the only that worked for me.

Is it possible to downgrade? or do I have to start over? Can I just clone other version of the repository into the same bench-repo directory?

I hope someone can help me.

Thaks
Jaime

Hi @Jaime_Stuardo, unfortunately it’s not possible to downgrade - you can only change to a higher version.

If you would like to avoid the headaches of self-hosting, check out https://frappecloud.com. :wink:

Thanks rmeyer… I think it was possible. I ran bench switch-to-branch version-12, and I got versions I wanted. I have not tested yet, though,

About using external service, it is not possible due to some reasons. First, it costs money. Second, information is confidential. I don’t want it to be flying across the cyberspace.

Regards
Jaime

1 Like

Yes, you can change the installed version but if you have an existing site it’s not safe to downgrade it. You will probably need to create a new site.

It doesn’t matter. I am moving a site from one hosting to other. Source hosting has the versions I need in the target hosting. So after the new site is created, I will be able to just copy the same database from one server to the other. That is the importance to have the exact same versions.

Regards
Jaime

Great!

I’d like to add to what our friend @rmeyer already said, for future readers.

TLDR: There is no such thing as a downgrade. Before upgrading ERPNext, backup your entire environment. That way you can restore it later, if you change your mind.

Details:

When you run the command bench switch-branch <new-branch>, this only performs a few git commands. Git checks out different commit hashes for frappe, erpnext, and other Apps. This modifies the files within your ../apps/ subdirectory. Notice I did not say all files in your environment. Only files located beneath apps

Also, that Bench command does not alter the MariaDB database. It does not restore the previous schema. It does not restore the previous data.

As an example. Let’s say you upgrade from v12 to v13. During that upgrade, several things happen to SQL table named foo:

  1. A column named ‘amount’ is renamed to ‘amount_currency’
  2. A column named ‘widget’ is dropped.
  3. A new column ‘margin’ is added, and populated with calculated data.

Everything upgrades successfully. You’re now using ERPNext v13. Great.

Later, you decide to run bench switch-branch version-12. What happens to SQL table foo?
Nothing.

Even if you follow-up with a bench migrate command, that will not restore SQL table foo to its earlier v12 condition. You must restore a SQL backup of your site’s database, taken prior to the v13 upgrade.

Remember too, ERPNext is more than Python Apps and SQL. When upgrading versions, probably Python dependencies were upgraded. Node.js dependencies were upgraded. If you want to use v12 again, those dependencies need to get rolled back, your Virtual Environment updated, rollups and bundles fixed.

ERPNext also contains a few other files (Procfile, common_site_config, etc.) which may have been modified during the Upgrade. Those too would need to be fixed.

There are a lot of ingredients that make a ERPNext environment. Everything must be synchronized for proper behavior.

Make regular backups of your entire ERPNext environment. Document the versions of everything you’re using, including MariaDB, Redis, Python, and more. If your VPS crashes and burns, make sure you know how to perform a complete recovery.

8 Likes

This is a great explanation.