2014-09-18 09:32:28 +02:00
|
|
|
.. _topics-setup-database:
|
2014-09-13 12:19:20 +02:00
|
|
|
|
|
|
|
|
=======================
|
|
|
|
|
How to setup a database
|
|
|
|
|
=======================
|
|
|
|
|
|
2024-07-08 19:00:26 +02:00
|
|
|
The :ref:`config-database` section of the configuration must be set before
|
|
|
|
|
starting.
|
2014-09-13 12:19:20 +02:00
|
|
|
|
|
|
|
|
Create a database
|
|
|
|
|
=================
|
|
|
|
|
|
|
|
|
|
Depending of the database backend choosen, you must create a database (see the
|
2020-11-29 11:35:29 +00:00
|
|
|
documentation of the choosen backend). The user running ``trytond`` must be
|
2014-09-13 12:19:20 +02:00
|
|
|
granted the priviledge to create tables. For backend that has the option, the
|
2020-11-29 11:35:29 +00:00
|
|
|
encoding of the database must be set to ``UTF-8``.
|
2014-09-13 12:19:20 +02:00
|
|
|
|
|
|
|
|
Initialize a database
|
|
|
|
|
=====================
|
|
|
|
|
|
2022-03-27 16:06:09 +02:00
|
|
|
A database can be initialized using this command line:
|
2014-09-13 12:19:20 +02:00
|
|
|
|
2022-03-27 16:06:09 +02:00
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
|
|
$ trytond-admin -c <config file> -d <database name> --all
|
2014-09-13 12:19:20 +02:00
|
|
|
|
2025-02-02 12:10:09 +01:00
|
|
|
At the end of the process, ``trytond-admin`` will ask you to set the email and
|
|
|
|
|
password for the ``admin`` `user <model-res.user>` that will be used to connect
|
|
|
|
|
to the server from one of the clients for the first time.
|
|
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
|
|
These users are different from the database user used in
|
|
|
|
|
:ref:`config-database.uri` of the database section.
|
2016-12-19 10:05:48 +01:00
|
|
|
|
|
|
|
|
Update a database
|
|
|
|
|
=================
|
|
|
|
|
|
2022-03-27 16:06:09 +02:00
|
|
|
To upgrade to a new series, the command line is:
|
2016-12-19 10:05:48 +01:00
|
|
|
|
2022-03-27 16:06:09 +02:00
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
|
|
$ trytond-admin -c <config file> -d <database name> --all
|
2016-12-19 10:05:48 +01:00
|
|
|
|
2024-07-13 12:14:29 +02:00
|
|
|
.. warning::
|
|
|
|
|
Because the database is modified in place it is important to make a backup before
|
|
|
|
|
running the update.
|
|
|
|
|
|
2016-12-19 10:05:48 +01:00
|
|
|
.. warning::
|
|
|
|
|
Prior to upgrade see if there is no manual action to take on the `migration
|
|
|
|
|
topic`_.
|
|
|
|
|
|
2024-11-24 00:35:36 +01:00
|
|
|
.. _`migration topic`: https://docs.tryton.org/migration
|
2016-12-19 10:05:48 +01:00
|
|
|
|
2022-03-27 16:06:09 +02:00
|
|
|
To activate a new language on an existing database, the command line is:
|
2016-12-19 10:05:48 +01:00
|
|
|
|
2022-03-27 16:06:09 +02:00
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
|
|
$ trytond-admin -c <config file> -d <database name> --all -l <language code>
|
2016-12-19 10:05:48 +01:00
|
|
|
|
|
|
|
|
Once activated, the language appears in the user preferences.
|
2017-11-22 23:48:35 +01:00
|
|
|
|
2022-03-27 16:06:09 +02:00
|
|
|
When installing new modules, the list of modules must be updated with:
|
2017-11-22 23:48:35 +01:00
|
|
|
|
2022-03-27 16:06:09 +02:00
|
|
|
.. code-block:: console
|
2017-11-22 23:48:35 +01:00
|
|
|
|
2022-03-27 16:06:09 +02:00
|
|
|
$ trytond-admin -c <config file> -d <database name> --update-modules-list
|
2017-11-22 23:48:35 +01:00
|
|
|
|
2022-03-27 16:06:09 +02:00
|
|
|
Once updated, the new modules can be activated from the client or activated with:
|
|
|
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
|
|
$ trytond-admin -c <config file> -d <database name> -u <module name> --activate-dependencies
|