MM-41191: Apply upload_sessions incorrect index fix (#19383)
https://mattermost.atlassian.net/browse/MM-41191 ```release-note NONE ``` Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
7026818f80
Коммит
d8fc23c86b
@@ -0,0 +1,19 @@
|
||||
DO $$
|
||||
<<alter_index>>
|
||||
DECLARE
|
||||
column_name text;
|
||||
BEGIN
|
||||
select array_to_string(array_agg(a.attname), ', ') as column_name INTO column_name
|
||||
from
|
||||
pg_index ix,
|
||||
pg_attribute a
|
||||
where
|
||||
ix.indexrelid='idx_uploadsessions_user_id'::regclass
|
||||
and a.attrelid = ix.indrelid
|
||||
and a.attnum = ANY(ix.indkey);
|
||||
|
||||
IF COALESCE (column_name, '') = text('userid') THEN
|
||||
DROP INDEX IF EXISTS idx_uploadsessions_user_id;
|
||||
CREATE INDEX IF NOT EXISTS idx_uploadsessions_user_id on uploadsessions(type);
|
||||
END IF;
|
||||
END alter_index $$;
|
||||
19
db/migrations/postgres/000075_alter_upload_sessions_index.up.sql
Обычный файл
19
db/migrations/postgres/000075_alter_upload_sessions_index.up.sql
Обычный файл
@@ -0,0 +1,19 @@
|
||||
DO $$
|
||||
<<alter_index>>
|
||||
DECLARE
|
||||
column_name text;
|
||||
BEGIN
|
||||
select array_to_string(array_agg(a.attname), ', ') as column_name INTO column_name
|
||||
from
|
||||
pg_index ix,
|
||||
pg_attribute a
|
||||
where
|
||||
ix.indexrelid='idx_uploadsessions_user_id'::regclass
|
||||
and a.attrelid = ix.indrelid
|
||||
and a.attnum = ANY(ix.indkey);
|
||||
|
||||
IF COALESCE (column_name, '') = text('type') THEN
|
||||
DROP INDEX IF EXISTS idx_uploadsessions_user_id;
|
||||
CREATE INDEX IF NOT EXISTS idx_uploadsessions_user_id on uploadsessions(userid);
|
||||
END IF;
|
||||
END alter_index $$;
|
||||
Ссылка в новой задаче
Block a user