Filter by templated schema name for postgres queries (#21635)
There were certain queries which did not filter by the current schema, but hardcoded public schema. Apart from that, we always filter with the current schema which allows connection proxies to run multiple MM within a single DB. ```release-note NONE ```
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
f07de38cc5
Коммит
91f7eb0957
@@ -35,6 +35,7 @@ BEGIN
|
|||||||
SELECT count(*) != 0 INTO column_exist
|
SELECT count(*) != 0 INTO column_exist
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'teams'
|
WHERE table_name = 'teams'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'alloweddomains'
|
AND column_name = 'alloweddomains'
|
||||||
AND NOT data_type = 'varchar(1000)';
|
AND NOT data_type = 'varchar(1000)';
|
||||||
IF column_exist THEN
|
IF column_exist THEN
|
||||||
@@ -49,6 +50,7 @@ BEGIN
|
|||||||
SELECT count(*) != 0 INTO column_exist
|
SELECT count(*) != 0 INTO column_exist
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'teams'
|
WHERE table_name = 'teams'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'groupconstrained'
|
AND column_name = 'groupconstrained'
|
||||||
AND NOT data_type = 'boolean';
|
AND NOT data_type = 'boolean';
|
||||||
IF column_exist THEN
|
IF column_exist THEN
|
||||||
@@ -63,6 +65,7 @@ BEGIN
|
|||||||
SELECT count(*) != 0 INTO column_exist
|
SELECT count(*) != 0 INTO column_exist
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'teams'
|
WHERE table_name = 'teams'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'type'
|
AND column_name = 'type'
|
||||||
AND NOT data_type = 'varchar(255)';
|
AND NOT data_type = 'varchar(255)';
|
||||||
IF column_exist THEN
|
IF column_exist THEN
|
||||||
@@ -77,6 +80,7 @@ BEGIN
|
|||||||
SELECT count(*) != 0 INTO column_exist
|
SELECT count(*) != 0 INTO column_exist
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'teams'
|
WHERE table_name = 'teams'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'schemeid'
|
AND column_name = 'schemeid'
|
||||||
AND NOT data_type = 'varchar(26)';
|
AND NOT data_type = 'varchar(26)';
|
||||||
IF column_exist THEN
|
IF column_exist THEN
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ BEGIN
|
|||||||
SELECT count(*) != 0 INTO column_exist
|
SELECT count(*) != 0 INTO column_exist
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'incomingwebhooks'
|
WHERE table_name = 'incomingwebhooks'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'description'
|
AND column_name = 'description'
|
||||||
AND NOT data_type = 'VARCHAR(500)';
|
AND NOT data_type = 'VARCHAR(500)';
|
||||||
IF column_exist THEN
|
IF column_exist THEN
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ BEGIN
|
|||||||
SELECT count(*) != 0 INTO column_exist
|
SELECT count(*) != 0 INTO column_exist
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'outgoingwebhooks'
|
WHERE table_name = 'outgoingwebhooks'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'description'
|
AND column_name = 'description'
|
||||||
AND NOT data_type = 'VARCHAR(500)';
|
AND NOT data_type = 'VARCHAR(500)';
|
||||||
IF column_exist THEN
|
IF column_exist THEN
|
||||||
@@ -44,6 +45,7 @@ BEGIN
|
|||||||
SELECT count(*) != 0 INTO column_exist
|
SELECT count(*) != 0 INTO column_exist
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'outgoingwebhooks'
|
WHERE table_name = 'outgoingwebhooks'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'iconurl'
|
AND column_name = 'iconurl'
|
||||||
AND NOT data_type = 'VARCHAR(1024)';
|
AND NOT data_type = 'VARCHAR(1024)';
|
||||||
IF column_exist THEN
|
IF column_exist THEN
|
||||||
@@ -56,7 +58,7 @@ BEGIN
|
|||||||
IF (
|
IF (
|
||||||
SELECT column_default::bigint
|
SELECT column_default::bigint
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_schema='public'
|
WHERE table_schema=current_schema()
|
||||||
AND table_name='outgoingwebhooks'
|
AND table_name='outgoingwebhooks'
|
||||||
AND column_name='username'
|
AND column_name='username'
|
||||||
) = 0 THEN
|
) = 0 THEN
|
||||||
@@ -69,7 +71,7 @@ BEGIN
|
|||||||
IF (
|
IF (
|
||||||
SELECT column_default::bigint
|
SELECT column_default::bigint
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_schema='public'
|
WHERE table_schema=current_schema()
|
||||||
AND table_name='outgoingwebhooks'
|
AND table_name='outgoingwebhooks'
|
||||||
AND column_name='iconurl'
|
AND column_name='iconurl'
|
||||||
) = 0 THEN
|
) = 0 THEN
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ BEGIN
|
|||||||
SELECT count(*) != 0 INTO column_exist
|
SELECT count(*) != 0 INTO column_exist
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'posts'
|
WHERE table_name = 'posts'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'fileids'
|
AND column_name = 'fileids'
|
||||||
AND NOT data_type = 'varchar(300)';
|
AND NOT data_type = 'varchar(300)';
|
||||||
IF column_exist THEN
|
IF column_exist THEN
|
||||||
|
|||||||
@@ -18,11 +18,13 @@ BEGIN
|
|||||||
SELECT count(*) != 0 INTO col_exists
|
SELECT count(*) != 0 INTO col_exists
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'preferences'
|
WHERE table_name = 'preferences'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'value';
|
AND column_name = 'value';
|
||||||
|
|
||||||
SELECT count(*) != 0 INTO type_exists
|
SELECT count(*) != 0 INTO type_exists
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'preferences'
|
WHERE table_name = 'preferences'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'value'
|
AND column_name = 'value'
|
||||||
AND data_type = 'character varying'
|
AND data_type = 'character varying'
|
||||||
AND character_maximum_length = 2000;
|
AND character_maximum_length = 2000;
|
||||||
|
|||||||
@@ -16,11 +16,13 @@ BEGIN
|
|||||||
SELECT count(*) != 0 INTO col_exists
|
SELECT count(*) != 0 INTO col_exists
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'tokens'
|
WHERE table_name = 'tokens'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'extra';
|
AND column_name = 'extra';
|
||||||
|
|
||||||
SELECT count(*) != 0 INTO type_exists
|
SELECT count(*) != 0 INTO type_exists
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'tokens'
|
WHERE table_name = 'tokens'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'extra'
|
AND column_name = 'extra'
|
||||||
AND data_type = 'character varying'
|
AND data_type = 'character varying'
|
||||||
AND character_maximum_length = 2048;
|
AND character_maximum_length = 2048;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ BEGIN
|
|||||||
SELECT count(*) != 0 INTO col_exist_and_type_different
|
SELECT count(*) != 0 INTO col_exist_and_type_different
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'sidebarchannels'
|
WHERE table_name = 'sidebarchannels'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'categoryid'
|
AND column_name = 'categoryid'
|
||||||
AND data_type = 'character varying'
|
AND data_type = 'character varying'
|
||||||
AND NOT character_maximum_length = 26;
|
AND NOT character_maximum_length = 26;
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ BEGIN
|
|||||||
SELECT count(*) != 0 INTO col_exist_and_type_different
|
SELECT count(*) != 0 INTO col_exist_and_type_different
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'sidebarchannels'
|
WHERE table_name = 'sidebarchannels'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'categoryid'
|
AND column_name = 'categoryid'
|
||||||
AND data_type = 'character varying'
|
AND data_type = 'character varying'
|
||||||
AND NOT character_maximum_length = 128;
|
AND NOT character_maximum_length = 128;
|
||||||
|
|||||||
@@ -19,11 +19,13 @@ BEGIN
|
|||||||
SELECT count(*) != 0 INTO col_exists
|
SELECT count(*) != 0 INTO col_exists
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'oauthauthdata'
|
WHERE table_name = 'oauthauthdata'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'state';
|
AND column_name = 'state';
|
||||||
|
|
||||||
SELECT count(*) != 0 INTO type_exists
|
SELECT count(*) != 0 INTO type_exists
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'oauthauthdata'
|
WHERE table_name = 'oauthauthdata'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'state'
|
AND column_name = 'state'
|
||||||
AND data_type = 'character varying'
|
AND data_type = 'character varying'
|
||||||
AND character_maximum_length = 1024;
|
AND character_maximum_length = 1024;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ BEGIN
|
|||||||
SELECT count(*) != 0 INTO col_exist_and_type_different
|
SELECT count(*) != 0 INTO col_exist_and_type_different
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'sidebarcategories'
|
WHERE table_name = 'sidebarcategories'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'id'
|
AND column_name = 'id'
|
||||||
AND data_type = 'character varying'
|
AND data_type = 'character varying'
|
||||||
AND NOT character_maximum_length = 26;
|
AND NOT character_maximum_length = 26;
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ BEGIN
|
|||||||
SELECT count(*) != 0 INTO col_exist_and_type_different
|
SELECT count(*) != 0 INTO col_exist_and_type_different
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'sidebarcategories'
|
WHERE table_name = 'sidebarcategories'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'id'
|
AND column_name = 'id'
|
||||||
AND data_type = 'character varying'
|
AND data_type = 'character varying'
|
||||||
AND NOT character_maximum_length = 128;
|
AND NOT character_maximum_length = 128;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ DO $$BEGIN
|
|||||||
IF (
|
IF (
|
||||||
SELECT column_default::bigint
|
SELECT column_default::bigint
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_schema='public'
|
WHERE table_schema=current_schema()
|
||||||
AND table_name='pluginkeyvaluestore'
|
AND table_name='pluginkeyvaluestore'
|
||||||
AND column_name='expireat'
|
AND column_name='expireat'
|
||||||
) IS NULL THEN
|
) IS NULL THEN
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ DO $$BEGIN
|
|||||||
IF (
|
IF (
|
||||||
SELECT column_default::bigint
|
SELECT column_default::bigint
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_schema='public'
|
WHERE table_schema=current_schema()
|
||||||
AND table_name='pluginkeyvaluestore'
|
AND table_name='pluginkeyvaluestore'
|
||||||
AND column_name='expireat'
|
AND column_name='expireat'
|
||||||
) = 0 THEN
|
) = 0 THEN
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ BEGIN
|
|||||||
SELECT count(*) != 0 INTO column_exist
|
SELECT count(*) != 0 INTO column_exist
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'users'
|
WHERE table_name = 'users'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'roles'
|
AND column_name = 'roles'
|
||||||
AND NOT data_type = 'varchar(256)';
|
AND NOT data_type = 'varchar(256)';
|
||||||
IF column_exist THEN
|
IF column_exist THEN
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ BEGIN
|
|||||||
SELECT count(*) != 0 INTO col_exist_and_type_different
|
SELECT count(*) != 0 INTO col_exist_and_type_different
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'channels'
|
WHERE table_name = 'channels'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'groupconstrained'
|
AND column_name = 'groupconstrained'
|
||||||
AND NOT data_type = 'boolean';
|
AND NOT data_type = 'boolean';
|
||||||
|
|
||||||
@@ -36,6 +37,7 @@ BEGIN
|
|||||||
SELECT count(*) != 0 INTO col_exist_and_type_different
|
SELECT count(*) != 0 INTO col_exist_and_type_different
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'channels'
|
WHERE table_name = 'channels'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'purpose'
|
AND column_name = 'purpose'
|
||||||
AND data_type = 'character varying'
|
AND data_type = 'character varying'
|
||||||
AND NOT character_maximum_length = 64;
|
AND NOT character_maximum_length = 64;
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ BEGIN
|
|||||||
SELECT count(*) != 0 INTO col_exist_and_type_different
|
SELECT count(*) != 0 INTO col_exist_and_type_different
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'channels'
|
WHERE table_name = 'channels'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'purpose'
|
AND column_name = 'purpose'
|
||||||
AND data_type = 'character varying'
|
AND data_type = 'character varying'
|
||||||
AND NOT character_maximum_length = 250;
|
AND NOT character_maximum_length = 250;
|
||||||
@@ -60,6 +61,7 @@ BEGIN
|
|||||||
SELECT count(*) != 0 INTO col_exist_and_type_different
|
SELECT count(*) != 0 INTO col_exist_and_type_different
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'channels'
|
WHERE table_name = 'channels'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'groupconstrained'
|
AND column_name = 'groupconstrained'
|
||||||
AND NOT data_type = 'boolean';
|
AND NOT data_type = 'boolean';
|
||||||
|
|
||||||
|
|||||||
@@ -10,11 +10,13 @@ BEGIN
|
|||||||
SELECT count(*) != 0 INTO msg_count_root_exist
|
SELECT count(*) != 0 INTO msg_count_root_exist
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'channels'
|
WHERE table_name = 'channels'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'totalmsgcountroot';
|
AND column_name = 'totalmsgcountroot';
|
||||||
|
|
||||||
SELECT count(*) != 0 INTO mention_count_root_exist
|
SELECT count(*) != 0 INTO mention_count_root_exist
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'channelmembers'
|
WHERE table_name = 'channelmembers'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'mentioncountroot';
|
AND column_name = 'mentioncountroot';
|
||||||
|
|
||||||
IF mention_count_root_exist THEN
|
IF mention_count_root_exist THEN
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ BEGIN
|
|||||||
SELECT count(*) != 0 INTO parentid_exist
|
SELECT count(*) != 0 INTO parentid_exist
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'commandwebhooks'
|
WHERE table_name = 'commandwebhooks'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'parentid';
|
AND column_name = 'parentid';
|
||||||
IF parentid_exist THEN
|
IF parentid_exist THEN
|
||||||
UPDATE commandwebhooks SET rootid = parentid WHERE rootid = '' AND rootid != parentid;
|
UPDATE commandwebhooks SET rootid = parentid WHERE rootid = '' AND rootid != parentid;
|
||||||
|
|||||||
@@ -8,16 +8,19 @@ BEGIN
|
|||||||
SELECT count(*) != 0 INTO parentid_exist
|
SELECT count(*) != 0 INTO parentid_exist
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'posts'
|
WHERE table_name = 'posts'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'parentid';
|
AND column_name = 'parentid';
|
||||||
SELECT count(*) != 0 INTO alter_fileids
|
SELECT count(*) != 0 INTO alter_fileids
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'posts'
|
WHERE table_name = 'posts'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'fileids'
|
AND column_name = 'fileids'
|
||||||
AND data_type = 'character varying'
|
AND data_type = 'character varying'
|
||||||
AND character_maximum_length != 300;
|
AND character_maximum_length != 300;
|
||||||
SELECT count(*) != 0 INTO alter_props
|
SELECT count(*) != 0 INTO alter_props
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'posts'
|
WHERE table_name = 'posts'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'props'
|
AND column_name = 'props'
|
||||||
AND data_type != 'jsonb';
|
AND data_type != 'jsonb';
|
||||||
IF alter_fileids OR alter_props THEN
|
IF alter_fileids OR alter_props THEN
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ BEGIN
|
|||||||
SELECT count(*) != 0 INTO column_exist
|
SELECT count(*) != 0 INTO column_exist
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'channelmembers'
|
WHERE table_name = 'channelmembers'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'roles'
|
AND column_name = 'roles'
|
||||||
AND NOT data_type = 'varchar(64)';
|
AND NOT data_type = 'varchar(64)';
|
||||||
IF column_exist THEN
|
IF column_exist THEN
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ BEGIN
|
|||||||
SELECT count(*) != 0 INTO column_exist
|
SELECT count(*) != 0 INTO column_exist
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'channelmembers'
|
WHERE table_name = 'channelmembers'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'roles'
|
AND column_name = 'roles'
|
||||||
AND NOT data_type = 'varchar(256)';
|
AND NOT data_type = 'varchar(256)';
|
||||||
IF column_exist THEN
|
IF column_exist THEN
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ BEGIN
|
|||||||
SELECT count(*) != 0 INTO column_exist
|
SELECT count(*) != 0 INTO column_exist
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'teammembers'
|
WHERE table_name = 'teammembers'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'roles'
|
AND column_name = 'roles'
|
||||||
AND NOT data_type = 'varchar(64)';
|
AND NOT data_type = 'varchar(64)';
|
||||||
IF column_exist THEN
|
IF column_exist THEN
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ BEGIN
|
|||||||
SELECT count(*) != 0 INTO column_exist
|
SELECT count(*) != 0 INTO column_exist
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'teammembers'
|
WHERE table_name = 'teammembers'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'roles'
|
AND column_name = 'roles'
|
||||||
AND NOT data_type = 'varchar(256)';
|
AND NOT data_type = 'varchar(256)';
|
||||||
IF column_exist THEN
|
IF column_exist THEN
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ BEGIN
|
|||||||
information_schema.columns
|
information_schema.columns
|
||||||
WHERE
|
WHERE
|
||||||
table_name = 'channels'
|
table_name = 'channels'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'lastrootpostat';
|
AND column_name = 'lastrootpostat';
|
||||||
IF NOT column_exist THEN
|
IF NOT column_exist THEN
|
||||||
ALTER TABLE channels ADD COLUMN lastrootpostat bigint DEFAULT '0'::bigint;
|
ALTER TABLE channels ADD COLUMN lastrootpostat bigint DEFAULT '0'::bigint;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ BEGIN
|
|||||||
SELECT count(*) != 0 INTO column_exist
|
SELECT count(*) != 0 INTO column_exist
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'sessions'
|
WHERE table_name = 'sessions'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'roles'
|
AND column_name = 'roles'
|
||||||
AND NOT data_type = 'varchar(64)';
|
AND NOT data_type = 'varchar(64)';
|
||||||
IF column_exist THEN
|
IF column_exist THEN
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ BEGIN
|
|||||||
SELECT count(*) != 0 INTO column_exist
|
SELECT count(*) != 0 INTO column_exist
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'sessions'
|
WHERE table_name = 'sessions'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'roles'
|
AND column_name = 'roles'
|
||||||
AND NOT data_type = 'varchar(256)';
|
AND NOT data_type = 'varchar(256)';
|
||||||
IF column_exist THEN
|
IF column_exist THEN
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ BEGIN
|
|||||||
SELECT count(*) != 0 INTO column_exist
|
SELECT count(*) != 0 INTO column_exist
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'pluginkeyvaluestore'
|
WHERE table_name = 'pluginkeyvaluestore'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'pkey'
|
AND column_name = 'pkey'
|
||||||
AND NOT data_type = 'varchar(50)';
|
AND NOT data_type = 'varchar(50)';
|
||||||
IF column_exist THEN
|
IF column_exist THEN
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ BEGIN
|
|||||||
SELECT count(*) != 0 INTO column_exist
|
SELECT count(*) != 0 INTO column_exist
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'pluginkeyvaluestore'
|
WHERE table_name = 'pluginkeyvaluestore'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'pkey'
|
AND column_name = 'pkey'
|
||||||
AND NOT data_type = 'varchar(150)';
|
AND NOT data_type = 'varchar(150)';
|
||||||
IF column_exist THEN
|
IF column_exist THEN
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ BEGIN
|
|||||||
IF (
|
IF (
|
||||||
SELECT count(*)
|
SELECT count(*)
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_schema='public'
|
WHERE table_schema=current_schema()
|
||||||
AND table_name='channels'
|
AND table_name='channels'
|
||||||
AND column_name='lastrootpostat'
|
AND column_name='lastrootpostat'
|
||||||
AND (column_default IS NULL OR column_default != '''0''::bigint')
|
AND (column_default IS NULL OR column_default != '''0''::bigint')
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ BEGIN
|
|||||||
SELECT count(*) != 0 INTO column_exist
|
SELECT count(*) != 0 INTO column_exist
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'oauthapps'
|
WHERE table_name = 'oauthapps'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'mattermostappid';
|
AND column_name = 'mattermostappid';
|
||||||
IF column_exist THEN
|
IF column_exist THEN
|
||||||
ALTER TABLE OAuthApps ALTER COLUMN MattermostAppID DROP NOT NULL;
|
ALTER TABLE OAuthApps ALTER COLUMN MattermostAppID DROP NOT NULL;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ BEGIN
|
|||||||
SELECT count(*) != 0 INTO column_exist
|
SELECT count(*) != 0 INTO column_exist
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'oauthapps'
|
WHERE table_name = 'oauthapps'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'mattermostappid';
|
AND column_name = 'mattermostappid';
|
||||||
IF column_exist THEN
|
IF column_exist THEN
|
||||||
UPDATE OAuthApps SET MattermostAppID = '' WHERE MattermostAppID IS NULL;
|
UPDATE OAuthApps SET MattermostAppID = '' WHERE MattermostAppID IS NULL;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ BEGIN
|
|||||||
SELECT count(*) != 0 INTO col_exist
|
SELECT count(*) != 0 INTO col_exist
|
||||||
FROM information_schema.columns
|
FROM information_schema.columns
|
||||||
WHERE table_name = 'users'
|
WHERE table_name = 'users'
|
||||||
|
AND table_schema = current_schema()
|
||||||
AND column_name = 'themeprops';
|
AND column_name = 'themeprops';
|
||||||
|
|
||||||
IF col_exist THEN
|
IF col_exist THEN
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user