# Database Migration Source Failure

**URL:** <https://forum.mattermost.com/t/database-migration-source-failure/21466>\
**Category:** Troubleshooting\
**Created:** [November 12, 2024, 9:26pm UTC](https://forum.mattermost.com/t/database-migration-source-failure/21466 "2024-11-12T21:26:34Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![itGirl27](https://avatars.discourse-cdn.com/v4/letter/i/ba9def/32.png) [@itGirl27](https://forum.mattermost.com/u/itGirl27)\
**Post date:** [November 12, 2024, 9:26pm UTC](https://forum.mattermost.com/t/database-migration-source-failure/21466/1 "2024-11-12T21:26:34Z")

</div>

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.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/mattermost/original/2X/9/97229fabdaa7e5d697d5125465ad2615a21407c2.png)

---

<div class="post-metadata">

**Author:** ![rtfm98](https://avatars.discourse-cdn.com/v4/letter/r/d9b06d/32.png) [@rtfm98](https://forum.mattermost.com/u/rtfm98)\
**Post date:** [November 13, 2024, 1:47pm UTC](https://forum.mattermost.com/t/database-migration-source-failure/21466/2 "2024-11-13T13:47:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![itGirl27](https://avatars.discourse-cdn.com/v4/letter/i/ba9def/32.png) [@itGirl27](https://forum.mattermost.com/u/itGirl27)\
**Post date:** [November 13, 2024, 2:09pm UTC](https://forum.mattermost.com/t/database-migration-source-failure/21466/3 "2024-11-13T14:09:16Z")

</div>

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](https://docs.mattermost.com/deploy/postgres-migration-assist-tool.html)

---

<div class="post-metadata">

**Author:** ![agnivade](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/agnivade/32/3846_2.png) [@agnivade](https://forum.mattermost.com/u/agnivade)\
**Post date:** [November 18, 2024, 9:03am UTC](https://forum.mattermost.com/t/database-migration-source-failure/21466/4 "2024-11-18T09:03:32Z")

</div>

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](https://github.com/mattermost/mattermost/tree/master/server/channels/db/migrations) 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

---

<div class="post-metadata">

**Author:** ![isacikgoz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/isacikgoz/32/4554_2.png) [@isacikgoz](https://forum.mattermost.com/u/isacikgoz)\
**Post date:** [November 18, 2024, 8:23pm UTC](https://forum.mattermost.com/t/database-migration-source-failure/21466/5 "2024-11-18T20:23:06Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![itGirl27](https://avatars.discourse-cdn.com/v4/letter/i/ba9def/32.png) [@itGirl27](https://forum.mattermost.com/u/itGirl27)\
**Post date:** [November 19, 2024, 9:02pm UTC](https://forum.mattermost.com/t/database-migration-source-failure/21466/6 "2024-11-19T21:02:52Z")

</div>

@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](https://us1.discourse-cdn.com/flex020/uploads/mattermost/original/2X/7/766d6e5d1c80c37629cc61f3f9ca50578f02617e.png)

---

<div class="post-metadata">

**Author:** ![agnivade](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/agnivade/32/3846_2.png) [@agnivade](https://forum.mattermost.com/u/agnivade)\
**Post date:** [November 20, 2024, 3:30am UTC](https://forum.mattermost.com/t/database-migration-source-failure/21466/7 "2024-11-20T03:30:42Z")

</div>

You have to pass the mySQL and postgresDSNs: [Automated PostgreSQL migration - Mattermost documentation](https://docs.mattermost.com/deploy/postgres-migration-assist-tool.html#step-6-complete-plugin-migrations)

---

<div class="post-metadata">

**Author:** ![itGirl27](https://avatars.discourse-cdn.com/v4/letter/i/ba9def/32.png) [@itGirl27](https://forum.mattermost.com/u/itGirl27)\
**Post date:** [November 20, 2024, 1:53pm UTC](https://forum.mattermost.com/t/database-migration-source-failure/21466/8 "2024-11-20T13:53:17Z")

</div>

I am passing both DSN’s here

```auto
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.

```
