Hi community,
We are trying to migrate our MySQL 8 database to PostgreSQL 15,
Following this doc: Migration guidelines from MySQL to PostgreSQL — Mattermost documentation.
But the migration no data gets migrated and pgloader
gives this error.
More details and Steps to Reproduce
We’ve been using mattermost old version - 5.37 and in the processes of upgrading to a newer version.
We are using MySQL 8 version database, as there is mentioned that PostgreSQL is the database of choice for Mattermost,
We are trying to migrate our MySQL 8 database to PostgreSQL 15,
Following this doc: Migration guidelines from MySQL to PostgreSQL — Mattermost documentation
What we’ve done so far to test and try out the process,
- Created two DB docker containers one for MySQL 8 and for Psql15.
- Loaded a copy of existing target data to mysql8 container based on mattermost version 6.7 (as already migration done to version 6.7).
- Created empty database and user on Psql15 following the documentation.
- Installed
go
andpgloader
on the server, installed required go packages. commands follows,
sudo apt-get install pgloader
mkdir ~/tmp/go
cd ~/tmp/go
wget https://go.dev/dl/go1.21.3.linux-amd64.tar.gz
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.21.3.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
# check
go version
# install packages
go install github.com/mattermost/morph/cmd/morph@v1
go install github.com/mattermost/dbcmp/cmd/dbcmp@latest
# for morph command
export PATH=$PATH:/home/$USER/go/bin
# Clone mattermost
git clone -b release-6.7 https://github.com/mattermost/mattermost.git --depth=1
# morph command
morph apply up --driver postgres --dsn "postgres://<user>:<pswd>@localhost:<docker exposed port>/mattermost?sslmode=disable" --path ./db/migrations/postgres --number -1
[note: the morph command give me some user permission errors first the migrations did not ran, when I used root postgres
user instead of mmuser
in the DSN it worked]
...
2023/10/26 01:20:41 == upgrade_oauth_mattermost_app_id: migrated (0.0060s) # ===========================================
81 migrations applied.
- Created the
migration.load
file as per the doc (I don’t have any expertise in postgres).
[note: the command is pgloader
for me not pgLoader
correct if it is a typo in the document.
this Line gives me error EXCLUDING TABLE NAMES MATCHING '~<IR_>', '~<focalboard>', 'schema_migrations'
because the missing quotes in doc, I’ve added that
Also, ALTER SCHEMA public RENAME TO mattermost;
this line gives me permission errors, that I fixed by changing psql user from mmuser
to postgres
]
- Finally the
pgloader migration.load > migration.log
executed but it finished quickly and themigration.log
shows this,
The data not getting transferred, How can I correct this