FAQ: I want to migrate Pleasanter, which is running on PostgreSQL 14, to a PostgreSQL 15 environment.
## Answer
Combine the restore process of the old environment (PostgresSQL14) and the Pleasanter installation process of the new environment (PostgresSQL15).
---
## Overview
This procedure assumes the following contents.
・The environment where PostgreSQL version 14 is installed is called the **old server**, and the environment where version 15 is installed is called the **new server**.
・The new server has completed the installation of the OS.**<span style="color: red; ">*Pleasanter and PostgreSQL are not installed.</span>**
・There is a working terminal that can connect to both the old and new servers.*This procedure assumes a Windows terminal.
・The old server has been installed using the procedure described in the user manual. *A database (Implem.Pleasanter) exists in the public schema.
### Environment Information
The environment information for the old and new servers described in the procedure is as follows.*As stated in the above assumptions, the new server has completed the installation of the OS before carrying out the procedure.
#### Old Server
・OS: AlmaLinux 9.2
・DB: PostgreSQL14
・Pleasanter: 1.3.43.0
#### New Server
・OS: AlmaLinux 9.2
・DB: PostgreSQL15
・Pleasanter: 1.3.48.0
*1.3.44.0 supports PostgreSQL15, and the specification is changed so that a database is not created in the public schema when running CodeDefiner for installation.
## Operation Procedure
1. On the old server, use the following command to obtain a backup of PostgreSQL.
```
pg_dumpall --roles-only > /backup/Implem.Pleasanter_role.dump
pg_dump -Fc Implem.Pleasanter > /backup/Implem.Pleasanter.dump
```
2. Copy the backup file obtained in 1 above to the new server. In this procedure, we will copy it to the "/backup" directory on the new server as follows.
・/backup/Implem.Pleasanter_role.dump
・/backup/Implem.Pleasanter.dump
3. Copy the "/web/pleasanter/Implem.Pleasanter/App_Data/Parameters" directory, which contains the parameters of the pleasanter on the old server, to the work terminal. In this procedure, we will copy it to the "C:\backup" folder as shown below.
・C:\backup\Parameters
4. Download the module of the target version (1.3.48.0) on the work terminal.
5. Extract the module (zip) downloaded in 4 above. In this procedure, we will extract it to the "C:\work" folder.
6. Compare the parameter files under each folder below and merge the setting values. *We recommend using a tool such as WinMerge to compare and merge.
・"C:\backup\Parameters" folder from 3 above
・"C:\work\pleasanter\Implem.Pleasanter\App_Data\Parameters" folder from 5 above *Merge with the files under this folder.
7. On the new server, refer to the following user manual and perform "PostgreSQL setup". *The Postgres user password is assumed to be the same as the old server.
・[Install Pleasanter on AlmaLinux](https://pleasanter.org/manual/getting-started-pleasanter-almalinux)
8. On the new server, execute the following command to create a database.
```
psql -U postgres -c 'create database "Implem.Pleasanter";'
psql -U postgres -c 'create extension if not exists pg_trgm;'
```
9. Use the backup file copied in 2 above to restore the role and database with the following command.
```
psql -f /backup/Implem.Pleasanter_role.dump
pg_restore -d Implem.Pleasanter /backup/Implem.Pleasanter.dump
```
10. Place the modules organized in 6 above on the new server. The image after placement is as follows.*Please change the directory permissions as appropriate.
・/web/pleasanter/Implem.Pleasanter
・/web/pleasanter/Implem.CodeDefiner
11. On the new server, refer to the following user manual and perform the subsequent steps from "Running CodeDefiner".
・[Install Pleasanter on AlmaLinux](https://pleasanter.org/manual/getting-started-pleasanter-almalinux)
12. Confirm that Pleasanter starts on the new server.