Upgrade from v13 to v14

I tried to upgrade from ERPNext: v13.34.2 / Frappe Framework: v13.34.0 to v14 on my docker installation.

After the upgrade i can’t access the frontend any more (500 Internal server error).

I’m getting exceptions after doing this in my docker-based setup (with a lot of followup exceptions):

/home/frappe/frappe-bench/apps/frappe/frappe/database/query.py:197: UserWarning: The 'filters_config' hook used to add custom operators is not yet implemented in frappe.db.query engine. Use db_query (frappe.get_list) instead.
warn(
[2022-08-03 11:10:09 +0000] [9] [ERROR] Error handling request /
Traceback (most recent call last):
File "/home/frappe/frappe-bench/apps/frappe/frappe/website/serve.py", line 18, in get_response
response = renderer_instance.render() ...

Also duringbench migrate several exceptions occure, but continuing and reporting success at the end. However the UI keeps unaccesible with the same error.

Any suggestion how to solve?

3 Likes

Any help or infor would be appreciated.

can you describe how did you do upgrade(commands)? I’m also having difficulties to upgrade, but I have errors with sql query.

Try commands from list, one after another:

  • bench migrate
  • bench switch-to-branch version-14 --upgrade
  • update --reset
  • bench restart

Did you install aditional apps like payments, hrms non_profit?

Thank you for your respond.
In ma docker installation i opened a console of the backend container and used the following commands:

bench --site testsite.lan set-config -p maintenance_mode 1
bench --site testsite.lan set-config -p pause_scheduler 1
bench --site testsite.lan migrate
bench --site testsite.lan set-config -p pause_scheduler 0
bench --site testsite.lan set-config -p maintenance_mode 0

The migrate command printed a punch of SQL error messages which i’m not sure if they are relevant or just because of not found tables or content.

The site in browser remains unaccesible with internal server errors (because of logged python errors on the backend container)
If i remove the asset volume and recreate this volume with the next start of v14 I can spin of the installation and until now seems to work well with all data available.

For the time being I managed to (potential) sucessful upgrade by

  • Ignoring the SQL error messages
  • removing the asset volume and let the next docker compuse up manage to recreate this volume

I’m not sure if ignoring and deleting/recreate asset volume is acceptible or if it will bring issues.

I did not run the switch-to-branch command - I will give it a try, if this prevents of the step to remove the asset volume

Try commands from list, one after another:

  • bench migrate
  • bench switch-to-branch version-14 --upgrade
  • update --reset
  • bench restart

Those commands are not applicable with a docker based installation

bench migrate wants a parameter --site set

All the next commands are not available in a docker based installation:
bench switch-to-branch version-14 --upgrade
update --reset
bench restart

also interessted in a solution to upgrade the docker containers

Hey,
I faced the same issue and decided to do my migration “by hand”

I installed a new container with frappe v14 on a side, backuped my v13 database through bench backup.

I restored the database with command psql mytable < mybackup

V14 comes with new tables, so I created it with this script:

-- Table: public."tabDocType State"

-- DROP TABLE public."tabDocType State";

CREATE TABLE public."tabDocType State"
(
    name character varying(140) COLLATE pg_catalog."default" NOT NULL,
    creation timestamp(6) without time zone,
    modified timestamp(6) without time zone,
    modified_by character varying(140) COLLATE pg_catalog."default",
    owner character varying(140) COLLATE pg_catalog."default",
    docstatus smallint NOT NULL DEFAULT '0'::smallint,
    idx bigint NOT NULL DEFAULT '0'::bigint,
    title character varying(140) COLLATE pg_catalog."default",
    color character varying(140) COLLATE pg_catalog."default" DEFAULT 'Blue'::character varying,
    custom smallint NOT NULL DEFAULT 0,
    parent character varying(140) COLLATE pg_catalog."default",
    parentfield character varying(140) COLLATE pg_catalog."default",
    parenttype character varying(140) COLLATE pg_catalog."default",
    CONSTRAINT "tabDocType State_pkey" PRIMARY KEY (name)
)

TABLESPACE pg_default;

ALTER TABLE public."tabDocType State"
    OWNER to _2de17b05f9ed9da2;
	
-- Table: public."tabData Import Log"

-- DROP TABLE public."tabData Import Log";

CREATE TABLE public."tabData Import Log"
(
    name character varying(140) COLLATE pg_catalog."default" NOT NULL,
    creation timestamp(6) without time zone,
    modified timestamp(6) without time zone,
    modified_by character varying(140) COLLATE pg_catalog."default",
    owner character varying(140) COLLATE pg_catalog."default",
    docstatus smallint NOT NULL DEFAULT '0'::smallint,
    idx bigint NOT NULL DEFAULT '0'::bigint,
    data_import character varying(140) COLLATE pg_catalog."default",
    row_indexes text COLLATE pg_catalog."default",
    success smallint NOT NULL DEFAULT 0,
    docname character varying(140) COLLATE pg_catalog."default",
    messages text COLLATE pg_catalog."default",
    exception text COLLATE pg_catalog."default",
    log_index bigint NOT NULL DEFAULT 0,
    _user_tags text COLLATE pg_catalog."default",
    _comments text COLLATE pg_catalog."default",
    _assign text COLLATE pg_catalog."default",
    _liked_by text COLLATE pg_catalog."default",
    CONSTRAINT "tabData Import Log_pkey" PRIMARY KEY (name)
)

TABLESPACE pg_default;

ALTER TABLE public."tabData Import Log"
    OWNER to _2de17b05f9ed9da2;
	
	
-- Table: public."tabDocument Share Key"

-- DROP TABLE public."tabDocument Share Key";

CREATE TABLE public."tabDocument Share Key"
(
    name character varying(140) COLLATE pg_catalog."default" NOT NULL,
    creation timestamp(6) without time zone,
    modified timestamp(6) without time zone,
    modified_by character varying(140) COLLATE pg_catalog."default",
    owner character varying(140) COLLATE pg_catalog."default",
    docstatus smallint NOT NULL DEFAULT '0'::smallint,
    idx bigint NOT NULL DEFAULT '0'::bigint,
    reference_doctype character varying(140) COLLATE pg_catalog."default",
    reference_docname character varying(140) COLLATE pg_catalog."default",
    key character varying(140) COLLATE pg_catalog."default",
    expires_on date,
    _user_tags text COLLATE pg_catalog."default",
    _comments text COLLATE pg_catalog."default",
    _assign text COLLATE pg_catalog."default",
    _liked_by text COLLATE pg_catalog."default",
    CONSTRAINT "tabDocument Share Key_pkey" PRIMARY KEY (name)
)

TABLESPACE pg_default;

ALTER TABLE public."tabDocument Share Key"
    OWNER to _2de17b05f9ed9da2;

-- Index: reference_docname

-- DROP INDEX public.reference_docname;

CREATE INDEX reference_docname
    ON public."tabDocument Share Key" USING btree
    (reference_docname COLLATE pg_catalog."default")
    TABLESPACE pg_default;

-- Table: public."tabIMAP Folder"

-- DROP TABLE public."tabIMAP Folder";

CREATE TABLE public."tabIMAP Folder"
(
    name character varying(140) COLLATE pg_catalog."default" NOT NULL,
    creation timestamp(6) without time zone,
    modified timestamp(6) without time zone,
    modified_by character varying(140) COLLATE pg_catalog."default",
    owner character varying(140) COLLATE pg_catalog."default",
    docstatus smallint NOT NULL DEFAULT '0'::smallint,
    idx bigint NOT NULL DEFAULT '0'::bigint,
    folder_name character varying(140) COLLATE pg_catalog."default",
    append_to character varying(140) COLLATE pg_catalog."default",
    uidvalidity character varying(140) COLLATE pg_catalog."default",
    uidnext character varying(140) COLLATE pg_catalog."default",
    parent character varying(140) COLLATE pg_catalog."default",
    parentfield character varying(140) COLLATE pg_catalog."default",
    parenttype character varying(140) COLLATE pg_catalog."default",
    CONSTRAINT "tabIMAP Folder_pkey" PRIMARY KEY (name)
)

TABLESPACE pg_default;

ALTER TABLE public."tabIMAP Folder"
    OWNER to _2de17b05f9ed9da2;

-- Table: public."tabLogs To Clear"

-- DROP TABLE public."tabLogs To Clear";

CREATE TABLE public."tabLogs To Clear"
(
    name character varying(140) COLLATE pg_catalog."default" NOT NULL,
    creation timestamp(6) without time zone,
    modified timestamp(6) without time zone,
    modified_by character varying(140) COLLATE pg_catalog."default",
    owner character varying(140) COLLATE pg_catalog."default",
    docstatus smallint NOT NULL DEFAULT '0'::smallint,
    idx bigint NOT NULL DEFAULT '0'::bigint,
    ref_doctype character varying(140) COLLATE pg_catalog."default",
    days bigint NOT NULL DEFAULT 30,
    parent character varying(140) COLLATE pg_catalog."default",
    parentfield character varying(140) COLLATE pg_catalog."default",
    parenttype character varying(140) COLLATE pg_catalog."default",
    CONSTRAINT "tabLogs To Clear_pkey" PRIMARY KEY (name)
)

TABLESPACE pg_default;

ALTER TABLE public."tabLogs To Clear"
    OWNER to _2de17b05f9ed9da2;
	
-- Table: public."tabNewsletter Attachment"

-- DROP TABLE public."tabNewsletter Attachment";

CREATE TABLE public."tabNewsletter Attachment"
(
    name character varying(140) COLLATE pg_catalog."default" NOT NULL,
    creation timestamp(6) without time zone,
    modified timestamp(6) without time zone,
    modified_by character varying(140) COLLATE pg_catalog."default",
    owner character varying(140) COLLATE pg_catalog."default",
    docstatus smallint NOT NULL DEFAULT '0'::smallint,
    idx bigint NOT NULL DEFAULT '0'::bigint,
    attachment text COLLATE pg_catalog."default",
    parent character varying(140) COLLATE pg_catalog."default",
    parentfield character varying(140) COLLATE pg_catalog."default",
    parenttype character varying(140) COLLATE pg_catalog."default",
    CONSTRAINT "tabNewsletter Attachment_pkey" PRIMARY KEY (name)
)

TABLESPACE pg_default;

ALTER TABLE public."tabNewsletter Attachment"
    OWNER to _2de17b05f9ed9da2;


-- Table: public."tabPackage"

-- DROP TABLE public."tabPackage";

CREATE TABLE public."tabPackage"
(
    name character varying(140) COLLATE pg_catalog."default" NOT NULL,
    creation timestamp(6) without time zone,
    modified timestamp(6) without time zone,
    modified_by character varying(140) COLLATE pg_catalog."default",
    owner character varying(140) COLLATE pg_catalog."default",
    docstatus smallint NOT NULL DEFAULT '0'::smallint,
    idx bigint NOT NULL DEFAULT '0'::bigint,
    package_name character varying(140) COLLATE pg_catalog."default",
    readme text COLLATE pg_catalog."default",
    license_type character varying(140) COLLATE pg_catalog."default",
    license text COLLATE pg_catalog."default",
    _user_tags text COLLATE pg_catalog."default",
    _comments text COLLATE pg_catalog."default",
    _assign text COLLATE pg_catalog."default",
    _liked_by text COLLATE pg_catalog."default",
    CONSTRAINT "tabPackage_pkey" PRIMARY KEY (name)
)

TABLESPACE pg_default;

ALTER TABLE public."tabPackage"
    OWNER to _2de17b05f9ed9da2;


-- Table: public."tabPackage Import"

-- DROP TABLE public."tabPackage Import";

CREATE TABLE public."tabPackage Import"
(
    name character varying(140) COLLATE pg_catalog."default" NOT NULL,
    creation timestamp(6) without time zone,
    modified timestamp(6) without time zone,
    modified_by character varying(140) COLLATE pg_catalog."default",
    owner character varying(140) COLLATE pg_catalog."default",
    docstatus smallint NOT NULL DEFAULT '0'::smallint,
    idx bigint NOT NULL DEFAULT '0'::bigint,
    attach_package text COLLATE pg_catalog."default",
    activate smallint NOT NULL DEFAULT 0,
    force smallint NOT NULL DEFAULT 0,
    log text COLLATE pg_catalog."default",
    _user_tags text COLLATE pg_catalog."default",
    _comments text COLLATE pg_catalog."default",
    _assign text COLLATE pg_catalog."default",
    _liked_by text COLLATE pg_catalog."default",
    CONSTRAINT "tabPackage Import_pkey" PRIMARY KEY (name)
)

TABLESPACE pg_default;

ALTER TABLE public."tabPackage Import"
    OWNER to _2de17b05f9ed9da2;

-- Table: public."tabPackage Release"

-- DROP TABLE public."tabPackage Release";

CREATE TABLE public."tabPackage Release"
(
    name character varying(140) COLLATE pg_catalog."default" NOT NULL,
    creation timestamp(6) without time zone,
    modified timestamp(6) without time zone,
    modified_by character varying(140) COLLATE pg_catalog."default",
    owner character varying(140) COLLATE pg_catalog."default",
    docstatus smallint NOT NULL DEFAULT '0'::smallint,
    idx bigint NOT NULL DEFAULT '0'::bigint,
    "package" character varying(140) COLLATE pg_catalog."default",
    publish smallint NOT NULL DEFAULT 0,
    path text COLLATE pg_catalog."default",
    major bigint NOT NULL DEFAULT 0,
    minor bigint NOT NULL DEFAULT 0,
    patch bigint NOT NULL DEFAULT 0,
    release_notes text COLLATE pg_catalog."default",
    _user_tags text COLLATE pg_catalog."default",
    _comments text COLLATE pg_catalog."default",
    _assign text COLLATE pg_catalog."default",
    _liked_by text COLLATE pg_catalog."default",
    CONSTRAINT "tabPackage Release_pkey" PRIMARY KEY (name)
)

TABLESPACE pg_default;

ALTER TABLE public."tabPackage Release"
    OWNER to _2de17b05f9ed9da2;

-- Table: public."tabPrint Format Field Template"

-- DROP TABLE public."tabPrint Format Field Template";

CREATE TABLE public."tabPrint Format Field Template"
(
    name character varying(140) COLLATE pg_catalog."default" NOT NULL,
    creation timestamp(6) without time zone,
    modified timestamp(6) without time zone,
    modified_by character varying(140) COLLATE pg_catalog."default",
    owner character varying(140) COLLATE pg_catalog."default",
    docstatus smallint NOT NULL DEFAULT '0'::smallint,
    idx bigint NOT NULL DEFAULT '0'::bigint,
    document_type character varying(140) COLLATE pg_catalog."default",
    field character varying(140) COLLATE pg_catalog."default",
    template_file character varying(140) COLLATE pg_catalog."default",
    module character varying(140) COLLATE pg_catalog."default",
    standard smallint NOT NULL DEFAULT 0,
    template text COLLATE pg_catalog."default",
    _user_tags text COLLATE pg_catalog."default",
    _comments text COLLATE pg_catalog."default",
    _assign text COLLATE pg_catalog."default",
    _liked_by text COLLATE pg_catalog."default",
    CONSTRAINT "tabPrint Format Field Template_pkey" PRIMARY KEY (name)
)

TABLESPACE pg_default;

ALTER TABLE public."tabPrint Format Field Template"
    OWNER to _2de17b05f9ed9da2;

-- Table: public."tabWeb Form List Column"

-- DROP TABLE public."tabWeb Form List Column";

CREATE TABLE public."tabWeb Form List Column"
(
    name bigint NOT NULL,
    creation timestamp(6) without time zone,
    modified timestamp(6) without time zone,
    modified_by character varying(140) COLLATE pg_catalog."default",
    owner character varying(140) COLLATE pg_catalog."default",
    docstatus smallint NOT NULL DEFAULT '0'::smallint,
    idx bigint NOT NULL DEFAULT '0'::bigint,
    fieldname character varying(140) COLLATE pg_catalog."default",
    fieldtype character varying(140) COLLATE pg_catalog."default",
    label character varying(140) COLLATE pg_catalog."default",
    parent character varying(140) COLLATE pg_catalog."default",
    parentfield character varying(140) COLLATE pg_catalog."default",
    parenttype character varying(140) COLLATE pg_catalog."default",
    CONSTRAINT "tabWeb Form List Column_pkey" PRIMARY KEY (name)
)

TABLESPACE pg_default;

ALTER TABLE public."tabWeb Form List Column"
    OWNER to _2de17b05f9ed9da2;

-- Table: public."tabWorkflow Action Permitted Role"

-- DROP TABLE public."tabWorkflow Action Permitted Role";

CREATE TABLE public."tabWorkflow Action Permitted Role"
(
    name character varying(140) COLLATE pg_catalog."default" NOT NULL,
    creation timestamp(6) without time zone,
    modified timestamp(6) without time zone,
    modified_by character varying(140) COLLATE pg_catalog."default",
    owner character varying(140) COLLATE pg_catalog."default",
    docstatus smallint NOT NULL DEFAULT '0'::smallint,
    idx bigint NOT NULL DEFAULT '0'::bigint,
    role character varying(140) COLLATE pg_catalog."default",
    parent character varying(140) COLLATE pg_catalog."default",
    parentfield character varying(140) COLLATE pg_catalog."default",
    parenttype character varying(140) COLLATE pg_catalog."default",
    CONSTRAINT "tabWorkflow Action Permitted Role_pkey" PRIMARY KEY (name)
)

TABLESPACE pg_default;

ALTER TABLE public."tabWorkflow Action Permitted Role"
    OWNER to _2de17b05f9ed9da2;

-- Table: public."tabWorkspace Quick List"

-- DROP TABLE public."tabWorkspace Quick List";

CREATE TABLE public."tabWorkspace Quick List"
(
    name character varying(140) COLLATE pg_catalog."default" NOT NULL,
    creation timestamp(6) without time zone,
    modified timestamp(6) without time zone,
    modified_by character varying(140) COLLATE pg_catalog."default",
    owner character varying(140) COLLATE pg_catalog."default",
    docstatus smallint NOT NULL DEFAULT '0'::smallint,
    idx bigint NOT NULL DEFAULT '0'::bigint,
    document_type character varying(140) COLLATE pg_catalog."default",
    label character varying(140) COLLATE pg_catalog."default",
    quick_list_filter text COLLATE pg_catalog."default",
    parent character varying(140) COLLATE pg_catalog."default",
    parentfield character varying(140) COLLATE pg_catalog."default",
    parenttype character varying(140) COLLATE pg_catalog."default",
    CONSTRAINT "tabWorkspace Quick List_pkey" PRIMARY KEY (name)
)

TABLESPACE pg_default;

ALTER TABLE public."tabWorkspace Quick List"
    OWNER to _2de17b05f9ed9da2;


Awesome!
I will try that tomorrrow and give Feedback but that Looks promising

Actually, it doesn’t work yet… I guess this is a necessary step, but I’m still facing issues with missing columns in the existing tables …

A migration script out of bench from the developper team would have been appreciated !

1 Like

After attempting to upgrade the dockerized system from 13.42.0 to 14.7.0 (both ERPNext and Frappe, same versions), I’m getting the same error in a different file:

/usr/local/lib/python3.10/functools.py:981: UserWarning: The 'filters_config' hook used to add custom operators is not yet implemented in frappe.db.query engine. Use db_query (frappe.get_list) instead.
  val = self.func(instance)
[2022-11-21 06:22:00 +0000] [7] [ERROR] Error handling request /
Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/website/serve.py", line 18, in get_response
    response = renderer_instance.render()

Still no solution???

For the record, this is what I did:

mariabackup ...
vim ~/gitops/erpnext-one.env
   FRAPPE_VERSION=v14.7.0
   ERPNEXT_VERSION=v14.7.0
docker compose --project-name erpnext-one   --env-file ~/gitops/erpnext-one.env   -f compose.yaml   -f overrides/compose.erpnext.yaml   -f overrides/compose.redis.yaml   -f docs/compose/compose.multi-bench.yaml config > ~/gitops/erpnext-one.yaml
docker compose --project-name erpnext-one -f ~/gitops/erpnext-one.yaml down
docker compose --project-name erpnext-one -f ~/gitops/erpnext-one.yaml up -d
docker compose --project-name erpnext-one exec backend bench --site SITE migrate