mirror of https://github.com/coder/coder.git
chore: fix down migration 196 (#13006)
It didn't account for null values.
This commit is contained in:
parent
319fd5bf1d
commit
3aa0d73811
|
@ -11,11 +11,15 @@ CREATE OR REPLACE FUNCTION revert_migrate_external_auth_providers_to_jsonb(jsonb
|
|||
DECLARE
|
||||
result text[];
|
||||
BEGIN
|
||||
SELECT
|
||||
array_agg(id::text) INTO result
|
||||
FROM (
|
||||
SELECT
|
||||
jsonb_array_elements($1) ->> 'id' AS id) AS external_auth_provider_ids;
|
||||
IF jsonb_typeof($1) = 'null' THEN
|
||||
result := '{}';
|
||||
ELSE
|
||||
SELECT
|
||||
array_agg(id::text) INTO result
|
||||
FROM (
|
||||
SELECT
|
||||
jsonb_array_elements($1) ->> 'id' AS id) AS external_auth_provider_ids;
|
||||
END IF;
|
||||
RETURN result;
|
||||
END;
|
||||
$$;
|
||||
|
|
Loading…
Reference in New Issue