Bench error while trying to downgrade from Version 13 to v8

Hello,

I’m trying to downgrade ERPNext from Version 13 to V 8.

After running
sudo bench switch-to-branch v8.x.x frappe erpnext --upgrade

I get the below error

Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 185, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/usr/lib/python3.8/runpy.py", line 111, in _get_module_details
    __import__(pkg_name)
  File "/opt/bench/erpnext/apps/frappe/frappe/__init__.py", line 322
    from frappe.async import publish_realtime
                ^
SyntaxError: invalid syntax

Traceback (most recent call last):
  File "/home/erpnext/.local/bin/bench", line 11, in <module>
    load_entry_point('frappe-bench', 'console_scripts', 'bench')()
  File "/opt/bench/bench-repo/bench/cli.py", line 48, in cli
    if sys.argv[1] in get_frappe_commands() + ["--site", "--verbose", "--force", "--profile"]:                                                                               
TypeError: unsupported operand type(s) for +: 'NoneType' and 'list'

Any help would be appreciated.

Hi,

A downgrade of this magnitude will be very difficult to achieve. A couple things to try:

bench migrate-env python2.7 (if 2.7 is on the host)
then
bench switch-to-branch v8.x.x frappe erpnext (sudo shouldn’t be needed)
then
bench update --patch

May we know why a downgrade is wanted?

Downgrading is not possible. Not unless you’re already an expert in ERPNext, -and- spend a lot of time on it.

The problem is not the Python and JS code. That part is easy. You can accomplish that with simple git commands (which is what 'bench switch-to-branch' is doing automatically for you).

The problem is the MySQL database. When you upgrade versions, the database schema changes. To handle this, ERPNext runs “patch” code. The patch code helps convert your business data (Customers, Sales Orders, Items, Bills of Material), from Old Schema --> New Schema.

However, ERPNext does not have “un-patch” code, that applies the data changes in the opposite direction. There is no process to transform v13 data tables into v8 data tables.

The only solution is performing this conversion manually, on your own. You would have to be extremely familiar with the ERPNext database schemas, default values per version, and a bunch of other stuff.

Can it be done? Yes. I’ve done a manual conversion like this 1 time. The effort was huge.

3 Likes