Problem updating database from 6.8 to 7.0 (Docker)

I tried to update my database using :

docker run --env DB_HOSTNAME=tryton_postgres --env DB_PASSWORD=XXXXXX --network tryton_network --interactive --tty --rm tryton/tryton trytond-admin -d tryton_database --all

This error is returned :

Traceback (most recent call last):
File “/usr/local/bin/trytond-admin”, line 33, in
admin.run(options)
File “/usr/local/lib/python3.11/dist-packages/trytond/admin.py”, line 57, in run
pool.init(update=options.update, lang=list(lang),
File “/usr/local/lib/python3.11/dist-packages/trytond/pool.py”, line 144, in init
restart = not load_modules(
_____________^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/dist-packages/trytond/modules/init.py”, line 396, in load_modules
_load_modules(update)
File “/usr/local/lib/python3.11/dist-packages/trytond/modules/init.py”, line 366, in _load_modules
load_module_graph(graph, pool, update, lang, indexes)
File “/usr/local/lib/python3.11/dist-packages/trytond/modules/init.py”, line 198, in load_module_graph
cls.register(module)
File “/usr/local/lib/python3.11/dist-packages/trytond/model/fields/fmany2one.py”, line 29, in register
table_h.add_fk(
File “/usr/local/lib/python3.11/dist-packages/trytond/backend/postgresql/table.py”, line 430, in add_fk
cursor.execute(
File “/usr/local/lib/python3.11/dist-packages/trytond/backend/postgresql/database.py”, line 71, in execute
cursor.execute(self, sql, args)
psycopg2.errors.ForeignKeyViolation: insert or update on table “ir_action_report” violates foreign key constraint “ir_action_report_model_model_fkey”
DETAIL: Key (model)=() is not present in table “ir_model”.

Am I doing something wrong ?
I think I must do these steps after the update and not before right ? Migration from 6.8 to 7.0
And the modules must be updated after these steps, right ?

Many thanks for what you do.

This error can happen only because you are upgrading to the series 7.2 and not 7.0.
In this case you must follow all the migration steps between 6.8 and 7.2.

1 Like

Many thanks for your fast answer.
It’s very nice.
Here is the command I used to update :

docker run --name tryton --env DB_HOSTNAME=postgres --env DB_PASSWORD=XXXXXX --mount source=tryton-data,target=/var/lib/trytond/db --network tryton_network --publish 127.0.0.1:8000:8000 --detach tryton/tryton:7.0

It seems docker is using version 7.0

I downgraded temporarily to 6.8 to get my list of modules and it did not showed this error.
I could connect normally.

EDIT :
Do I have to update tryton-data too ?

This does not launch trytond-admin update command.

No the data structure does not change.

Thanks for your answer.
What trytond-admin update command are you talking about please ?
The one I put in the first post ? Problem updating database from 6.8 to 7.0 (Docker)
Or another one ?

You told me I used tryton 7.2.
I showed I used the tag 7.0 to update the tryton container before trying to update the database.

https://docs.tryton.org/latest/server/topics/setup_database.html#update-a-database

The first command you posted was not using the tag 7.0 so you actually run the trytond-admin command with the latest version which is 7.2.

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.