Remove is_valid_json function from database
This commit is contained in:
parent
7bab0ec5c5
commit
7a365c61d8
2 changed files with 27 additions and 16 deletions
26
db/migrate/20210209174657_remove_is_valid_json_function.rb
Normal file
26
db/migrate/20210209174657_remove_is_valid_json_function.rb
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# License: AGPL-3.0-or-later WITH WTO-AP-3.0-or-later
|
||||||
|
# Full license explanation at https://github.com/houdiniproject/houdini/blob/master/LICENSE
|
||||||
|
class RemoveIsValidJsonFunction < ActiveRecord::Migration[6.1]
|
||||||
|
def up
|
||||||
|
execute <<-SQL
|
||||||
|
DROP FUNCTION public.is_valid_json
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
execute <<-SQL
|
||||||
|
CREATE FUNCTION public.is_valid_json(p_json text) RETURNS boolean
|
||||||
|
LANGUAGE plpgsql IMMUTABLE
|
||||||
|
AS $$
|
||||||
|
begin
|
||||||
|
return (p_json::json is not null);
|
||||||
|
exception
|
||||||
|
when others then
|
||||||
|
return false;
|
||||||
|
end;
|
||||||
|
$$;
|
||||||
|
SQL
|
||||||
|
end
|
||||||
|
end
|
|
@ -37,22 +37,6 @@ CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA public;
|
||||||
COMMENT ON EXTENSION "uuid-ossp" IS 'generate universally unique identifiers (UUIDs)';
|
COMMENT ON EXTENSION "uuid-ossp" IS 'generate universally unique identifiers (UUIDs)';
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: is_valid_json(text); Type: FUNCTION; Schema: public; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE FUNCTION public.is_valid_json(p_json text) RETURNS boolean
|
|
||||||
LANGUAGE plpgsql IMMUTABLE
|
|
||||||
AS $$
|
|
||||||
begin
|
|
||||||
return (p_json::json is not null);
|
|
||||||
exception
|
|
||||||
when others then
|
|
||||||
return false;
|
|
||||||
end;
|
|
||||||
$$;
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: update_supporter_assoc_search_vectors(); Type: FUNCTION; Schema: public; Owner: -
|
-- Name: update_supporter_assoc_search_vectors(); Type: FUNCTION; Schema: public; Owner: -
|
||||||
--
|
--
|
||||||
|
@ -4475,5 +4459,6 @@ INSERT INTO "schema_migrations" (version) VALUES
|
||||||
('20210208211655'),
|
('20210208211655'),
|
||||||
('20210208212655'),
|
('20210208212655'),
|
||||||
('20210209002832');
|
('20210209002832');
|
||||||
|
('20210209174657');
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue