[root@mattermost mattermost-migration-assist]# pgloader boards.load > boards_migration.log
KABOOM!
FATAL error: Database error 3F000: schema "public" does not exist
QUERY: ALTER SCHEMA public RENAME TO mattermostdb;
An unhandled error condition has been signalled:
Database error 3F000: schema "public" does not exist
QUERY: ALTER SCHEMA public RENAME TO mattermostdb;
What I am doing here?
Database error 3F000: schema "public" does not exist
QUERY: ALTER SCHEMA public RENAME TO mattermostdb;
I checked the logs from the earlier steps and found that normally you do an rename of public to mattermostdb and at the end you rename the schema back to public.
This seems to fail but I can see no error in my logfile.
Now I’m not sure if this is the only problem with the migration and i do not know how to check if everything is correct.
My migration.log ends with:
I try to migrate a 9.11 LTS version and we never used postgres before so it is a “little bit” frustrating to change a good working system to something you do not know.
Another point in you documentation, we set the rights like you showed at: Prepare your Mattermost database - Mattermost documentation
for RedHat systems and we failed to connect to localhost.
We had to add:
host all all 127.0.0.1/32 trust
because localhost will be resolved as 127.0.0.1 and not ::1.
At the end this migration is a little bit annoying because of all the around problems (like MySQL 8 native_password problems).
First step after db creations and rights settings:
Schema creation:
[root@mattermost mattermost-migration-assist]# ./migration-assist postgres "postgres://mmuser:my_secret_password@localhost:5432/mattermost?sslmode=disable" --run-migrations --mattermost-version="v9.11.4"
2024-12-02 11:09:03 pinging postgres...
2024-12-02 11:09:03 connected to postgres successfully.
An Error Occurred: could not check schema owner: the user "mmuser" is not owner of the "public" schema
Hi Silvio! Thank you for your detailed feedback and for walking through the steps so thoroughly. It sounds like there may be an issue with ownership and permissions for the public schema. You can try explicitly changing the schema ownership with this command: ALTER SCHEMA public OWNER TO mmuser; as outlined in our Postgres Migration Assist Tool documentation. If the issue persists, double-check that all prerequisites are met, including PostgreSQL configuration settings mentioned in the database preparation guide. Let us know how it goes or if additional questions arise!
thanks for the answer.
As I wrote, I startet again and followed the steps.
I ignored the ownership message with the “–check-schema-owner=false” option and it was possible to create the schema.
After that, the import was working and also the module import was possible.
The next step was to change the settings in the config.json.
I would be nice if you add the infos how you have to change to postgres.
Yes you can find the info in the documentation that you have to set it to postgres and not postgresql and also you have to change to postgres://user:pass … but it would be easier if you add a link to this part of the docu.
At the end the server did not start with:
Dec 3 17:42:48 mattermost mattermost[2007440]: info [2024-12-03 17:42:48.260 Z] Server is initializing... caller="platform/service.go:175" go_version=go1.21.8
Dec 3 17:42:48 mattermost mattermost[2007440]: info [2024-12-03 17:42:48.261 Z] Pinging SQL caller="sql/sql_utils.go:67" database=master dataSource="postgres://%2A%2A%2A%2A:%2A%2A%2A%2A@localhost:5432/m
attermost?connect_timeout=10&sslmode=disable"
Dec 3 17:42:48 mattermost mattermost[2007440]: Error: failed to initialize platform: cannot create store: failed to apply database migrations: driver: postgres, message: failed to fetch current schema, command: current_schema, originalEr
ror: sql: Scan error on column index 0, name "current_schema": converting NULL to string is unsupported, query:
Dec 3 17:42:48 mattermost mattermost[2007440]: SELECT CURRENT_SCHEMA()
Dec 3 17:42:48 mattermost mattermost[2007440]: error [2024-12-03 17:42:48.266 Z] 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:
and I was not really irritated by this.
Fortunately I found:
and that solved the problem.
Now I have to run backup and recovery checks and all the stuff around.
Hi Silvio! Thanks so much for following up and sharing your progress. You’ve made great strides in overcoming those roadblocks. I’m glad you found a solution to the schema ownership issue, and I appreciate your thoughtful suggestion about including more explicit details in the documentation, especially regarding config.json changes and database connection strings.
I’ll pass along your feedback to the documentation and migration tool teams to consider these improvements. Good luck with your backup and recovery checks, and feel free to let us know if you run into any further issues or have additional insights to share!