Upgrade issue: database schema changes

I have a setup for ERPNext 14 with following applications installed:

  • frappe
  • erpnext
  • payments
  • hrms

After a recent upgrade via bench update command to version 14.58.1, the following error appears when accessing the General Ledger:

pymysql.err.OperationalError: (1054, “Unknown column ‘gocardless_mandate’ in ‘field list’”)

Here is a full trace back of the error:

App Versions

	"erpnext": "14.58.1",
	"frappe": "14.62.1",
	"hrms": "14.21.0",
	"payments": "0.0.1"


query-report/General Ledger


Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 95, in application
    response = frappe.api.handle()
  File "apps/frappe/frappe/api.py", line 55, in handle
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 47, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 85, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1628, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/__init__.py", line 808, in wrapper_fn
    retval = fn(*args, **get_newargs(fn, kwargs))
  File "apps/frappe/frappe/desk/query_report.py", line 239, in run
    result = generate_report_result(report, filters, user, custom_columns, is_tree, parent_field)
  File "apps/frappe/frappe/__init__.py", line 808, in wrapper_fn
    retval = fn(*args, **get_newargs(fn, kwargs))
  File "apps/frappe/frappe/desk/query_report.py", line 89, in generate_report_result
    res = get_report_result(report, filters) or []
  File "apps/frappe/frappe/desk/query_report.py", line 70, in get_report_result
    res = report.execute_script_report(filters)
  File "apps/frappe/frappe/core/doctype/report/report.py", line 131, in execute_script_report
    res = self.execute_module(filters)
  File "apps/frappe/frappe/core/doctype/report/report.py", line 148, in execute_module
    return frappe.get_attr(method_name)(frappe._dict(filters))
  File "apps/erpnext/erpnext/accounts/report/general_ledger/general_ledger.py", line 49, in execute
    res = get_result(filters, account_details)
  File "apps/erpnext/erpnext/accounts/report/general_ledger/general_ledger.py", line 152, in get_result
    gl_entries = get_gl_entries(filters, accounting_dimensions)
  File "apps/erpnext/erpnext/accounts/report/general_ledger/general_ledger.py", line 193, in get_gl_entries
    gl_entries = frappe.db.sql(
  File "apps/frappe/frappe/database/database.py", line 220, in sql
    self._cursor.execute(query, values)
  File "env/lib/python3.10/site-packages/pymysql/cursors.py", line 158, in execute
    result = self._query(query)
  File "env/lib/python3.10/site-packages/pymysql/cursors.py", line 325, in _query
  File "env/lib/python3.10/site-packages/pymysql/connections.py", line 549, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "env/lib/python3.10/site-packages/pymysql/connections.py", line 779, in _read_query_result
  File "env/lib/python3.10/site-packages/pymysql/connections.py", line 1157, in read
    first_packet = self.connection._read_packet()
  File "env/lib/python3.10/site-packages/pymysql/connections.py", line 729, in _read_packet
  File "env/lib/python3.10/site-packages/pymysql/protocol.py", line 221, in raise_for_error
  File "env/lib/python3.10/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.OperationalError: (1054, "Unknown column 'gocardless_mandate' in 'field list'")

Request Data

	"type": "GET",
	"args": {
		"report_name": "General Ledger",
		"filters": "{\"company\":\"Dream Company\",\"from_date\":\"2023-12-07\",\"to_date\":\"2024-01-07\",\"account\":[],\"party\":[],\"group_by\":\"Group by Voucher (Consolidated)\",\"cost_center\":[],\"project\":[],\"gocardless_mandate\":[],\"include_dimensions\":1,\"include_default_book_entries\":1}",
		"ignore_prepared_report": false,
		"are_default_filters": false
	"headers": {},
	"error_handlers": {},
	"url": "/api/method/frappe.desk.query_report.run"

Response Data

	"exception": "pymysql.err.OperationalError: (1054, \"Unknown column 'gocardless_mandate' in 'field list'\")"

The strange thing is, I have another setup went through the exact same upgrade but with no issue whatsoever.
Appreciate any help I can get. thanks

Hi @ahmedsahly,

Please again migrate it.

any customization added in the report because

gocardless_mandate related filter is not available in the standard report. so check it.

Thank You!

Hi Nihantra ,

Unfortunately I had done this before (bench --site test.test migrate) then cleared the cash and restarted bench however it didn’t solve the issue. Moreover, I had uninstalled and reinstalled the payments app but no luck either.

It’s default filter or you add it? please check it.

Thank You!

Hi Nihantra,

It is default filter. I didn’t add any filter.