Database Migration Source Failure

Performing migration to postgres database from mysql. First attempt, data didn’t migrate over to postgres database. Second attempt, getting strange error message when running migrations. Please help.

In my opinion the migration assistent needs both: connection details to mysql (source) and postgres (destination) database. Otherwise, it can’t know which data to migrate

I ran both commands. I was successfully able to connect to the mysql database first using the following command :

migration-assist mysql “<MYSQL_DSN>” # example DSN: “user:password@tcp(address:3306)/db_name”

The command that throws the error is the second step in the guide listed here : https://docs.mattermost.com/deploy/postgres-migration-assist-tool.html

This is happening because your machine is unable to perform the git clone needed to get the migrations. If you are unable to allow git to clone the server migrations needed, you have 2 options:

  • Either clone them manually and pass the --migrations-dir flag to the postgres command. In that case, you don’t need to pass the --mattermost-version. The migrations-dir should be the mattermost/server/channels/db/migrations at master · mattermost/mattermost · GitHub directory for the given MM version - in your case 9.11.4.
  • Or download the latest version of the tool, and then re-run the same set of steps again. But this time supply the --applied-migrations flag to the postgres command, and pass the mysql.output file from the mysql command.

cc @isacikgoz

2 Likes

@itGirl27 Since v0.2 migration-assist contains the mattermost migrations in the binary itself. So, if you are having issues fetching the migrations, as @agnivade mentioned I’d recommend using --applied-migrations="mysql.output" flag/file to perform that step. It will use the output file to determine which migrations are required and then apply them.

1 Like

@agnivade @isacikgoz I tried running the migrations with the flag --applied-migrations=“mysql.output” It says migrations applied. But when i get to the final steps of the migration guide, I’m getting the following error loading calls playbooks, & boards.

image

You have to pass the mySQL and postgresDSNs: Automated PostgreSQL migration - Mattermost documentation

I am passing both DSN’s here

root@mattermost-test:/opt/migration-assist# ./migration-assist pgloader boards --mysql='mmuser:USERPASSWORD@tcp(127.0.0.1:3306)/mattermost' --postgres='postgres://mmuser:USERPASSWORD@127.0.0.1:5432/mattermost' > boards.load
2024-11-07 15:05:07 pinging postgres...
2024-11-07 15:05:07 connected to postgres successfully.

root@mattermost-test:/opt/migration-assist# ./migration-assist pgloader playbooks --mysql='mmuser:USERPASSWORD@tcp(127.0.0.1:3306)/mattermost' --postgres='postgres://mmuser:USERPASSWORD@127.0.0.1:5432/mattermost' > playbooks.load
2024-11-07 15:06:11 pinging postgres...
2024-11-07 15:06:11 connected to postgres successfully.

root@mattermost-test:/opt/migration-assist# ./migration-assist pgloader calls --mysql='mmuser:USERPASSWORD@tcp(127.0.0.1:3306)/mattermost' --postgres='postgres://mmuser:USERPASSWORD@127.0.0.1:5432/mattermost' > calls.load
2024-11-07 15:06:31 pinging postgres...
2024-11-07 15:06:31 connected to postgres successfully.