Closed isacikgoz closed 1 month ago
This "bug" affected me, and after hours of search I found the solution.
Whet the migration finished I tried to start Mattermost, but it is failed because SELECT CURRENT_SCHEMA();
SQL command returned nothing:
mattermost=> SELECT CURRENT_SCHEMA();
current_schema
----------------
(1 row)
The SEARCH_PATH
looked liked this:
mattermost=> SHOW SEARCH_PATH;
search_path
---------------------
"""$user"", public"
(1 row)
But it is wrong. To make it work, I had to set by hand the it as postgres
user:
ALTER ROLE mmuser SET search_path = "$user", public;
After that, this is what the SEARCH_PATH
and CURRENT_SCHEMA()
looked like:
mattermost=# SELECT CURRENT_SCHEMA();
current_schema
----------------
public
(1 row)
mattermost=# SHOW SEARCH_PATH;
search_path
-----------------
"$user", public
(1 row)
@agnivade Since migration-assist
itself is not running pgloader
, the idea here is to use migration-assist post-migrate
as a safety check, after pgloader
runs. That's why I made the index creation rely on the CLI flag. There will be a doc update to recommend checking whether they need to look into fixes. But I think new CheckPostgresSchemaOwnership
implementation should fix the issue regardless.
That's why I made the index creation rely on the CLI flag.
So to clarify: this schema check is only needed to run the index creation? I thought this was there as a sanity check to run Mattermost later?
@agnivade nope, I mean this command will run (at least we'll advise that) after whenever a pgloader
execution happens.
Summary
After every migration, we should advise running
migration-assist post-migrate
command to determine the health of the DB in terms of schema and it's ownership.Also make index creation optional. Will add documentation accordingly.
Ticket Link
https://mattermost.atlassian.net/browse/MM-60328