From 1fdd8d13d9aa19434f9ec1593bf5b5ea841c2ebb Mon Sep 17 00:00:00 2001 From: Wayne Wollesen Date: Mon, 27 Apr 2026 21:17:42 -0500 Subject: [PATCH 1/4] Add \c mattermost step to PostgreSQL preparation grants The ALTER SCHEMA public and GRANT USAGE, CREATE ON SCHEMA public commands operate on the current database's public schema, so users must connect to the mattermost database before running them. Without \c mattermost, these grants are applied to the wrong database's public schema. Co-Authored-By: Claude Opus 4.7 (1M context) --- source/deployment-guide/server/preparations.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/source/deployment-guide/server/preparations.rst b/source/deployment-guide/server/preparations.rst index 1bc4db44840..6325dad795a 100644 --- a/source/deployment-guide/server/preparations.rst +++ b/source/deployment-guide/server/preparations.rst @@ -62,6 +62,7 @@ PostgreSQL v14+ is required for Mattermost server installations. :doc:`MySQL dat .. code-block:: sql ALTER DATABASE mattermost OWNER TO mmuser; + \c mattermost ALTER SCHEMA public OWNER TO mmuser; GRANT USAGE, CREATE ON SCHEMA public TO mmuser; From d209c34b4bdc08b2ae9a85648643d5322fab7606 Mon Sep 17 00:00:00 2001 From: Wayne Wollesen Date: Mon, 27 Apr 2026 21:28:46 -0500 Subject: [PATCH 2/4] Add comment explaining the \c mattermost step Clarifies that the connection switch is what makes the subsequent ALTER SCHEMA and GRANT commands target the mattermost database's public schema. Co-Authored-By: Claude Opus 4.7 (1M context) --- source/deployment-guide/server/preparations.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/source/deployment-guide/server/preparations.rst b/source/deployment-guide/server/preparations.rst index 6325dad795a..b2e6df6168c 100644 --- a/source/deployment-guide/server/preparations.rst +++ b/source/deployment-guide/server/preparations.rst @@ -62,6 +62,7 @@ PostgreSQL v14+ is required for Mattermost server installations. :doc:`MySQL dat .. code-block:: sql ALTER DATABASE mattermost OWNER TO mmuser; + -- Connect to the mattermost database so the schema grants below apply to the right schema \c mattermost ALTER SCHEMA public OWNER TO mmuser; GRANT USAGE, CREATE ON SCHEMA public TO mmuser; From f4e61628e52f4ab361312e538b73095eb7b02947 Mon Sep 17 00:00:00 2001 From: Wayne Wollesen Date: Mon, 27 Apr 2026 21:37:30 -0500 Subject: [PATCH 3/4] Switch code-block to postgresql to handle \c cleanly The generic sql lexer flags \c as an unknown token (red error box in rendered output). The postgresql lexer recognizes psql meta-commands like \c as builtins, so the block renders cleanly while still highlighting the SQL statements. Co-Authored-By: Claude Opus 4.7 (1M context) --- source/deployment-guide/server/preparations.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/deployment-guide/server/preparations.rst b/source/deployment-guide/server/preparations.rst index b2e6df6168c..76a799b85dc 100644 --- a/source/deployment-guide/server/preparations.rst +++ b/source/deployment-guide/server/preparations.rst @@ -59,7 +59,7 @@ PostgreSQL v14+ is required for Mattermost server installations. :doc:`MySQL dat e. If using PostgreSQL v15.x or later, additional grants are required: - .. code-block:: sql + .. code-block:: postgresql ALTER DATABASE mattermost OWNER TO mmuser; -- Connect to the mattermost database so the schema grants below apply to the right schema From b75ae924d5bbef14876bd8380a093aef2573bd06 Mon Sep 17 00:00:00 2001 From: Wayne Wollesen Date: Mon, 27 Apr 2026 21:51:37 -0500 Subject: [PATCH 4/4] Use text lexer to avoid Pygments error token on \c Both the sql and postgresql Pygments lexers flag backslash-prefixed psql meta-commands as error tokens (rendered as a red box). Switch to the text lexer so the block renders cleanly. Loses SQL syntax highlighting on four lines, but keeps the commands as a single copy-pasteable unit. Co-Authored-By: Claude Opus 4.7 (1M context) --- source/deployment-guide/server/preparations.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/deployment-guide/server/preparations.rst b/source/deployment-guide/server/preparations.rst index 76a799b85dc..5bc0ea997d0 100644 --- a/source/deployment-guide/server/preparations.rst +++ b/source/deployment-guide/server/preparations.rst @@ -59,7 +59,7 @@ PostgreSQL v14+ is required for Mattermost server installations. :doc:`MySQL dat e. If using PostgreSQL v15.x or later, additional grants are required: - .. code-block:: postgresql + .. code-block:: text ALTER DATABASE mattermost OWNER TO mmuser; -- Connect to the mattermost database so the schema grants below apply to the right schema