How to correctly migrate the database from privacyidea 3.9.2 to privacyidea 3.11.1

Hi everyone. Can you tell me how to update privacyidea 3.9.2 to privacyidea 3.11. Currently installed 1 server in the prod and 2 test servers. All of them have version 3.9.2. I tried to update via privacyidea-pip-update on the test servers, one of them updated only to version 3.9.3 on the second test server to 3.10.2.How to update correctly or should I install 3.11 and then migrate? I apologize for the childish questions, I am new to Linux and DB. I eventually want to upgrade all servers to the latest version and set up a galera cluster

This very much depends on you installation.
Ubuntu installations will update the database automagically.

Under the hood you can check the database versions using the pi-manage db tool.

Database is migrated by scripts located in /opt/privacyidea/lib/privacyidea/migrations.

The command

pi-manage db history -d /opt/privacyidea/lib/privacyidea/migrations/

will show you all migrations / database changes.

Lucky you — the comments will actually indicate the versions, since 3.9 is rather new.

Hope this basic understanding helps as a starting point.