From ec292f661f0a2b9678f625b5506c26240a7bde09 Mon Sep 17 00:00:00 2001 From: Miguel de la Cruz Date: Wed, 29 Mar 2023 22:13:25 +0200 Subject: [PATCH] Fix schema migration check for postgres (#4661) Co-authored-by: Mattermost Build --- server/services/store/sqlstore/schema_table_migration.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/services/store/sqlstore/schema_table_migration.go b/server/services/store/sqlstore/schema_table_migration.go index 7a6f911dd..913a5320c 100644 --- a/server/services/store/sqlstore/schema_table_migration.go +++ b/server/services/store/sqlstore/schema_table_migration.go @@ -123,8 +123,11 @@ func (s *SQLStore) isSchemaMigrationNeeded() (bool, error) { "TABLE_NAME": s.tablePrefix + "schema_migrations", }) - if s.dbType == model.MysqlDBType { + switch s.dbType { + case model.MysqlDBType: query = query.Where(sq.Eq{"TABLE_SCHEMA": s.schemaName}) + case model.PostgresDBType: + query = query.Where(sq.Eq{"TABLE_SCHEMA": "current_schema()"}) } rows, err := query.Query()