Alright so I’m trying to use the migration tool to move from mariadb to postgres.
I started creating the database using the Prepare your Mattermost database - Mattermost documentation step by step all fine.
Then I managed to go through all the processes in Automated PostgreSQL migration - Mattermost documentation with some issues including the addons migration.
- the migration log returns a huge list or errors
$ cat migration.log
2025-03-15T10:11:15.060000Z LOG pgloader version “3.6.7~devel”
2025-03-15T10:11:22.550009Z LOG Migrating from #<MYSQL-CONNECTION mysql://mmuser@000.000.000.000:3306/mattermost {10066772A3}>
2025-03-15T10:11:22.550009Z LOG Migrating into #<PGSQL-CONNECTION pgsql://mmuser@000.000.000.000:5432/mattermost {1006677323}>
2025-03-15T10:11:26.740013Z WARNING Source column “mattermost”.“ChannelBookmarks”.“displayname” is casted to type “varchar” which is not the same as “text”, the type of current target database column “mattermost”.“channelbookmarks”.“displayname”.
2025-03-15T10:11:26.740013Z WARNING Source column “mattermost”.“ChannelBookmarks”.“sortorder” is casted to type “bigint” which is not the same as “integer”, the type of current target database column “mattermost”.“channelbookmarks”.“sortorder”.
2025-03-15T10:11:26.740013Z WARNING Source column “mattermost”.“ChannelBookmarks”.“linkurl” is casted to type “varchar” which is not the same as “text”, the type of current target database column “mattermost”.“channelbookmarks”.“linkurl”.
2025-03-15T10:11:26.740013Z WARNING Source column “mattermost”.“ChannelBookmarks”.“imageurl” is casted to type “varchar” which is not the same as “text”, the type of current target database column “mattermost”.“channelbookmarks”.“imageurl”.
2025-03-15T10:11:26.740013Z WARNING Source column “mattermost”.“ChannelBookmarks”.“type” is casted to type “channel_bookmark_type” which is not the same as “mattermost.channel_bookmark_type”, the type of current target database column “mattermost”.“channelbookmarks”.“type”.
2025-03-15T10:11:26.740013Z WARNING Source column “mattermost”.“ChannelMembers”.“notifyprops” is casted to type “text” which is not the same as “jsonb”, the type of current target database column “mattermost”.“channelmembers”.“notifyprops”.
2025-03-15T10:11:26.740013Z WARNING Source column “mattermost”.“Channels”.“type” is casted to type “channel_type” which is not the same as “mattermost.channel_type”, the type of current target database column “mattermost”.“channels”.“type”.
2025-03-15T10:11:26.740013Z WARNING Source column “mattermost”.“Jobs”.“data” is casted to type “text” which is not the same as “jsonb”, the type of current target database column “mattermost”.“jobs”.“data”.
2025-03-15T10:11:26.740013Z WARNING Source column “mattermost”.“LinkMetadata”.“data” is casted to type “text” which is not the same as “jsonb”, the type of current target database column “mattermost”.“linkmetadata”.“data”.
2025-03-15T10:11:26.740013Z WARNING Source column “mattermost”.“OutgoingOAuthConnections”.“oauthtokenurl” is casted to type “varchar” which is not the same as “text”, the type of current target database column “mattermost”.“outgoingoauthconnections”.“oauthtokenurl”.
2025-03-15T10:11:26.740013Z WARNING Source column “mattermost”.“OutgoingOAuthConnections”.“granttype” is casted to type “varchar” which is not the same as “mattermost.outgoingoauthconnections_granttype”, the type of current target database column “mattermost”.“outgoingoauthconnections”.“granttype”.
2025-03-15T10:11:26.740013Z WARNING Source column “mattermost”.“Posts”.“props” is casted to type “text” which is not the same as “jsonb”, the type of current target database column “mattermost”.“posts”.“props”.
2025-03-15T10:11:26.740013Z WARNING Source column “mattermost”.“Preferences”.“value” is casted to type “varchar” which is not the same as “text”, the type of current target database column “mattermost”.“preferences”.“value”.
2025-03-15T10:11:26.740013Z ERROR pgloader failed to find target table for source “mattermost”.“PropertyFields” with name “propertyfields” in target catalog
2025-03-15T10:11:26.740013Z ERROR pgloader failed to find target table for source “mattermost”.“PropertyGroups” with name “propertygroups” in target catalog
2025-03-15T10:11:26.740013Z ERROR pgloader failed to find target table for source “mattermost”.“PropertyValues” with name “propertyvalues” in target catalog
2025-03-15T10:11:26.740013Z WARNING Source column “mattermost”.“RecentSearches”.“query” is casted to type “text” which is not the same as “jsonb”, the type of current target database column “mattermost”.“recentsearches”.“query”.
2025-03-15T10:11:26.740013Z WARNING Source column “mattermost”.“RetentionIdsForDeletion”.“ids” is casted to type “text” which is not the same as “character varying”, the type of current target database column “mattermost”.“retentionidsfordeletion”.“ids”.
2025-03-15T10:11:26.740013Z ERROR pgloader failed to find target table for source “mattermost”.“ScheduledPosts” with name “scheduledposts” in target catalog
2025-03-15T10:11:26.740013Z WARNING Source column “mattermost”.“Sessions”.“props” is casted to type “text” which is not the same as “jsonb”, the type of current target database column “mattermost”.“sessions”.“props”.
2025-03-15T10:11:26.740013Z WARNING Source column “mattermost”.“Teams”.“type” is casted to type “team_type” which is not the same as “mattermost.team_type”, the type of current target database column “mattermost”.“teams”.“type”.
2025-03-15T10:11:26.740013Z WARNING Source column “mattermost”.“Threads”.“participants” is casted to type “text” which is not the same as “jsonb”, the type of current target database column “mattermost”.“threads”.“participants”.
2025-03-15T10:11:26.740013Z WARNING Source column “mattermost”.“UploadSessions”.“type” is casted to type “upload_session_type” which is not the same as “mattermost.upload_session_type”, the type of current target database column “mattermost”.“uploadsessions”.“type”.
2025-03-15T10:11:26.740013Z WARNING Source column “mattermost”.“Users”.“props” is casted to type “text” which is not the same as “jsonb”, the type of current target database column “mattermost”.“users”.“props”.
2025-03-15T10:11:26.750013Z WARNING Source column “mattermost”.“Users”.“notifyprops” is casted to type “text” which is not the same as “jsonb”, the type of current target database column “mattermost”.“users”.“notifyprops”.
2025-03-15T10:11:26.750013Z WARNING Source column “mattermost”.“Users”.“timezone” is casted to type “text” which is not the same as “jsonb”, the type of current target database column “mattermost”.“users”.“timezone”.
2025-03-15T10:11:26.750013Z WARNING Source column “mattermost”.“Users”.“mfausedtimestamps” is casted to type “text” which is not the same as “jsonb”, the type of current target database column “mattermost”.“users”.“mfausedtimestamps”.
2025-03-15T10:11:26.750013Z LOG Skipping mattermost.propertyfields
2025-03-15T10:11:26.750013Z LOG Skipping mattermost.propertygroups
2025-03-15T10:11:26.750013Z LOG Skipping mattermost.propertyvalues
2025-03-15T10:11:26.750013Z LOG Skipping mattermost.scheduledposts
2025-03-15T10:11:27.490015Z WARNING PostgreSQL warning: constraint “fk_retentionpolicieschannels_retentionpolicies” of relation “retentionpolicieschannels” does not exist, skipping
2025-03-15T10:11:27.740014Z WARNING PostgreSQL warning: constraint “fk_retentionpoliciesteams_retentionpolicies” of relation “retentionpoliciesteams” does not exist, skipping
2025-03-15T10:12:12.350068Z LOG report summary reset
- When I try to run mattermost server, the server returns database errors.
mattermost[1692828]: Error: failed to initialize platform: cannot create store: failed to apply database migrations: driver: postgres, message: failed to fetch current schema, command: current_schema, originalError: sql: Scan error on column index 0, name “current_schema”: converting NULL to string is unsupported, query:
mattermost[1692828]: SELECT CURRENT_SCHEMA()
mattermost[1692828]: Usage:
mattermost[1692828]: mattermost [flags]
mattermost[1692828]: mattermost [command]
mattermost[1692828]: Available Commands:
mattermost[1692828]: completion Generate the autocompletion script for the specified shell
mattermost[1692828]: db Commands related to the database
mattermost[1692828]: export Export data from Mattermost
mattermost[1692828]: help Help about any command
mattermost[1692828]: import Import data.
mattermost[1692828]: jobserver Start the Mattermost job server
mattermost[1692828]: server Run the Mattermost server
mattermost[1692828]: version Display version information
mattermost[1692828]: Flags:
mattermost[1692828]: -c, --config string Configuration file to use.
mattermost[1692828]: -h, --help help for mattermost
mattermost[1692828]: Use “mattermost [command] --help” for more information about a command.
systemd[1]: mattermost.service: Main process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
- during the migration process, the last stages when migrating the addons, all 3 fails.
[~]$ pgloader boards.load > boards_migration.log
KABOOM!
UNDEFINED-TABLE: Database error 42P01: relation “mattermost.focalboard_blocks” does not exist
QUERY: UPDATE mattermost.focalboard_blocks SET “fields” = ‘{}’::json WHERE “fields”::text = ‘’;
An unhandled error condition has been signalled:
Database error 42P01: relation “mattermost.focalboard_blocks” does not exist
QUERY: UPDATE mattermost.focalboard_blocks SET “fields” = ‘{}’::json WHERE “fields”::text = ‘’;
What I am doing here?
Database error 42P01: relation “mattermost.focalboard_blocks” does not exist
QUERY: UPDATE mattermost.focalboard_blocks SET “fields” = ‘{}’::json WHERE “fields”::text = ‘’;
[~]$ pgloader playbooks.load > playbooks_migration.log
KABOOM!
DATABASE-ERROR: Database error 3F000: schema “public” does not exist
QUERY: ALTER SCHEMA public RENAME TO mattermost;
An unhandled error condition has been signalled:
Database error 3F000: schema “public” does not exist
QUERY: ALTER SCHEMA public RENAME TO mattermost;
What I am doing here?
Database error 3F000: schema “public” does not exist
QUERY: ALTER SCHEMA public RENAME TO mattermost;
[~]$ pgloader calls.load > calls.log
KABOOM!
DATABASE-ERROR: Database error 3F000: schema “public” does not exist
QUERY: ALTER SCHEMA public RENAME TO mattermost;
An unhandled error condition has been signalled:
Database error 3F000: schema “public” does not exist
QUERY: ALTER SCHEMA public RENAME TO mattermost;
What I am doing here?
Database error 3F000: schema “public” does not exist
QUERY: ALTER SCHEMA public RENAME TO mattermost;
I really need help on this.