Error in migration-assist with creating postgres schema

Summary
Error in migration database from mysql to (PostgreSQL) 17.5 (Ubuntu 17.5-1.pgdg22.04+1)

Steps to reproduce

  1. migration-assist mysql “<MYSQL_DSN>” - sucsess
  2. migration-assist postgres “<POSTGRES_DSN>”
    –run-migrations
    –mattermost-version=“<MATTERMOST_VERSION>” - error

Expected behavior
Creating the PostgreSQL database schema

Observed behavior
panic: runtime error: slice bounds out of range [1:0]

goroutine 1 [running]:
github.com/mattermost/migration-assist/internal/store.extractPostgresDatabaseNameFromURL(...)
/home/runner/work/migration-assist/migration-assist/internal/store/postgres.go:47
github.com/mattermost/migration-assist/internal/store.openPostgres({0x7fff533236cd, 0x40})
/home/runner/work/migration-assist/migration-assist/internal/store/postgres.go:23 +0x1fd
github.com/mattermost/migration-assist/internal/store.NewStore({0xd7d274?, 0xd7c88f?}, {0x7fff533236cd?, 0xd7b32d?})
/home/runner/work/migration-assist/migration-assist/internal/store/store.go:44 +0x65
github.com/mattermost/migration-assist/cmd/migration-assist/commands.runTargetCheckCmdF(0xc0000fbb08, {0xc0003094d0, 0x1, 0xd7b32d?})
/home/runner/work/migration-assist/migration-assist/cmd/migration-assist/commands/postgres.go:71 +0x14c
github.com/spf13/cobra.(*Command).execute(0xc0000fbb08, {0xc000309440, 0x3, 0x3})
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:983 +0xaaa
github.com/spf13/cobra.(*Command).ExecuteC(0x14e9f20)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1039
main.main()
/home/runner/work/migration-assist/migration-assist/cmd/migration-assist/main.go:31 +0x115

What version of MySQL are you on (and it needs to be MySQL, not MariaDB)? And what version of Mattermost? How big is your database, how many users, etc.?

Current MySQL and Mattermost
mysql Ver 8.0.42-0ubuntu0.22.04.1 for Linux on x86_64 ((Ubuntu))
Mattermost version: 10.1.2
Database schema version: 127
Build number: 11462506876
Database: mysql

Database is around 540 Mb
±---------------------------------±----------+
| Table | Size (MB) |
±---------------------------------±----------+
| Posts | 357 |
| FileInfo | 72 |
| Jobs | 58 |
| LinkMetadata | 14 |
| Audits | 13 |
| ThreadMemberships | 13 |
| Reactions | 4 |
| Threads | 4 |
| focalboard_blocks | 2 |
| focalboard_blocks_history | 1 |
| Preferences | 1 |
| ChannelMembers | 1 |
| Channels | 0 |
| focalboard_boards_history | 0 |

We have around 30 users, only 12 is active (others are deactivated)

10.1 is pretty old. Can you update to 10.5.7? That’ll make sure you have the most recent migration tools. There are a few mentions in the changelog that suggest that may be the fix.

If not… I’m not a database expert, I can ask internally for more ideas. Mattermost could be a good resource too.

I’ll try to update to 10.5.7 and try migration again and will return with results.

Mattermost: 10.5.7
Database version: 135
Build number: 15186613021
Database: mysql

Same error
panic: runtime error: slice bounds out of range [1:0]

goroutine 1 [running]:
github.com/mattermost/migration-assist/internal/store.extractPostgresDatabaseNameFromURL(...)
/home/runner/work/migration-assist/migration-assist/internal/store/postgres.go:47
github.com/mattermost/migration-assist/internal/store.openPostgres({0x7ffe6bd8c6b6, 0x40})
/home/runner/work/migration-assist/migration-assist/internal/store/postgres.go:23 +0x1fd
github.com/mattermost/migration-assist/internal/store.NewStore({0xd7d274?, 0xd7c88f?}, {0x7ffe6bd8c6b6?, 0xd7b32d?})
/home/runner/work/migration-assist/migration-assist/internal/store/store.go:44 +0x65
github.com/mattermost/migration-assist/cmd/migration-assist/commands.runTargetCheckCmdF(0xc000426308, {0xc00038afc0, 0x1, 0xd7b32d?})
/home/runner/work/migration-assist/migration-assist/cmd/migration-assist/commands/postgres.go:71 +0x14c
github.com/spf13/cobra.(*Command).execute(0xc000426308, {0xc00038af30, 0x3, 0x3})
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:983 +0xaaa
github.com/spf13/cobra.(*Command).ExecuteC(0x14e9f20)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1039
main.main()
/home/runner/work/migration-assist/migration-assist/cmd/migration-assist/main.go:31 +0x115

looks like it’s error within migration-assist tool. Tried 0.2 and 0.4

The problem was with # symbol in postgresql password for mmsuer.
The most stupid thing that same symbol in migration assist with mysql password user works just fine. So if someone have same problem as me - use password without ANY symbols and add them later by changing password and reconfiguring configuration.json file.

1 Like