Migration 5.4 > 5.6, sqldump import

Because I moved my system to a new version, I did a fresh install of docker and tryton and thus accidentially ended up with trytond 5.6.5.

Then I imported my 5.4 sqldump and tried to log in at the web client, which shows this error:

Traceback (most recent call last):
  File "/usr/local/lib/python37/dist-packages/trytond/wsgipy", line 109, in dispatch_request
    return endpoint(request, **requestview_args)
  File "/usr/local/lib/python37/dist-packages/trytond/protocols/dispatcherpy", line 48, in rpc
    request, database_name, *requestrpc_params)
  File "/usr/local/lib/python37/dist-packages/trytond/protocols/dispatcherpy", line 63, in login
    database_name, user, parameters, context=context)
  File "/usr/local/lib/python37/dist-packages/trytond/securitypy", line 50, in login
    session = user_id, Sessionnew()
  File "/usr/local/lib/python37/dist-packages/trytond/ir/sessionpy", line 51, in new
    session, = clscreate([values])
  File "/usr/local/lib/python37/dist-packages/trytond/ir/sessionpy", line 149, in create
    return super(Session, cls)create(vlist)
  File "/usr/local/lib/python37/dist-packages/trytond/model/modelsqlpy", line 159, in wrapper
    return func(cls, *args, **kwargs)
  File "/usr/local/lib/python37/dist-packages/trytond/model/modelsqlpy", line 676, in create
    clstrigger_create(records)
  File "/usr/local/lib/python37/dist-packages/trytond/model/modelstoragepy", line 76, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python37/dist-packages/trytond/model/modelstoragepy", line 166, in trigger_create
    triggers = Triggerget_triggers(cls__name__, 'create')
  File "/usr/local/lib/python37/dist-packages/trytond/ir/triggerpy", line 178, in get_triggers
    ('on_%s' % mode, '=', True),
  File "/usr/local/lib/python37/dist-packages/trytond/model/modelsqlpy", line 1317, in search
    cursorexecute(*select)
  File "/usr/local/lib/python37/dist-packages/trytond/backend/postgresql/databasepy", line 69, in execute
    cursorexecute(self, sql, args)
psycopg2ProgrammingError: column aaction does not exist
LINE 1: SELECT "a""id" AS "id", "a""action" AS "action", "a""acti
                                 ^
HINT:  Perhaps you meant to reference the column "aactive"

My guess is that comes from the different versions. I read @pokoli’s hints on migration 5.4 > 5.6, but could not understand it. What shall I do?

Cheers,
Wolf

PS: Thanks for making the quote look reasonable. I ever wanted to know how to do that… Lesson learned… (:

When updating to a new series, you must perform a database update. But also check if there are any manual task to do from https://discuss.tryton.org/c/migration/6.

Thank you, Cédric. About database update with this command:
trytond-admin -c <config file> -d <database name> --all

  • How does it work with docker?
  • Do I need to perform that with the tryton-postgres only - or with tryton as well?
  • Which config file is meant ?

Thanks a lot in advace,
Wolf

Abend Wolf,

docker run \
    --link tryton-postgres:postgres \
    -e DB_PASSWORD=mysecretpassword \
    -it tryton/tryton \
    --rm \
    trytond-admin -c $TRYTON_CONFIG -d tryton --all

In the Docker Container we have the environment variable $TRYTON_CONFIG which contains the path (/etc/trytond.conf) to the config file.
If you want to see what’s in your config file you can start a bash-Session inside your running container with the following command:

docker exec -it tryton bash

Then you can see it’s contents with cat $TRYTOND_CONFIG

The tryton-container contains only the code, while the data is stored in the database. So you execute the script from the tryton-container, which – as far as I understand it – modifies the data in the tryton-postgres-container.

The config file is described in the official documentation.

Hope I could help you.

I put all above into one long line an got this error:

[uWSGI] getting INI configuration from /etc/uwsgi.conf
uwsgi: unrecognized option '--rm'
getopt_long() error

Arguments passed after the image name are passed to the entrypoint of the image.
Here --rm is a docker run option to remove container at the end so it should be before the image name:

$ docker run \
    --link tryton-postgres:postgres \
    -e DB_PASSWORD=mysecretpassword \
    --rm \
    -it tryton/tryton \
    trytond-admin -c $TRYTON_CONFIG -d tryton --all

Thank you very much. This is what I get:

$ sudo docker run --link tryton-postgres:postgres -e DB_PASSWORD=[mysecretpassword] --rm -it tryton/tryton trytond-admin -c $TRYTON_CONFIG -d tryton --all

[sudo] Passwort für [user]:
usage: trytond-admin [-h] [–version] [-c FILE [FILE …]] [-v] [–dev]
[-d DATABASE [DATABASE …]] [–logconf FILE]
[-u MODULE [MODULE …]] [–all]
[–activate-dependencies] [–email EMAIL] [-p]
[–reset-password] [-m] [-l CODE [CODE …]]
[–hostname HOSTNAME]
trytond-admin: error: argument -c/–config: expected at least one argument

-c $TRYTON_CONFIG is evaluated outside the docker container so it is missing.
But indeed I think you do not need it at all because the entrypoint.sh will set it.

Thank you Cédric. Next try is this one:

$ sudo docker run --link tryton-postgres:postgres -e DB_PASSWORD=[mysecretpw] -it tryton/tryton trytond-admin -d tryton --all
could not load tryton,himBHsd
Traceback (most recent call last):
  File "/usr/local/bin/trytond-admin", line 21, in <module>
admin.run(options)
  File "/usr/local/lib/python3.7/dist-packages/trytond/admin.py", line 20, in run
Database = backend.get('Database')
  File "/usr/local/lib/python3.7/dist-packages/trytond/backend/__init__.py", line 22, in get
db_type = name()
  File "/usr/local/lib/python3.7/dist-packages/trytond/backend/__init__.py", line 18, in name
config.get('database', 'uri', default='')).scheme
  File "/usr/lib/python3.7/urllib/parse.py", line 368, in urlparse
splitresult = urlsplit(url, scheme, allow_fragments)
  File "/usr/lib/python3.7/urllib/parse.py", line 459, in urlsplit
raise ValueError("Invalid IPv6 URL")
ValueError: Invalid IPv6 URL

It seems you have left the -c option.

In fact, I messed up copy and paste. ):
With the command above (no -c option, as I understood msg #7), the process finished. But I’m not yet sure whether it actually worked, I described the problem after import HERE.