From 419a4c8e8ce3705197fa71beff18b4e2e8e4ec9c Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Fri, 30 Aug 2019 16:42:03 +0200 Subject: [PATCH] Update trim_html_tags Postgres function [SCI-3726] --- .../20190830141257_update_trim_html_tags_function.rb | 12 ++++++++++++ db/schema.rb | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20190830141257_update_trim_html_tags_function.rb diff --git a/db/migrate/20190830141257_update_trim_html_tags_function.rb b/db/migrate/20190830141257_update_trim_html_tags_function.rb new file mode 100644 index 000000000..5aecbb38a --- /dev/null +++ b/db/migrate/20190830141257_update_trim_html_tags_function.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +class UpdateTrimHtmlTagsFunction < ActiveRecord::Migration[5.2] + def up + execute( + "CREATE OR REPLACE FUNCTION + trim_html_tags(IN input TEXT, OUT output TEXT) AS $$ + SELECT regexp_replace(input, E'<[^>]*>', '', 'g'); + $$ LANGUAGE SQL;" + ) + end +end diff --git a/db/schema.rb b/db/schema.rb index aabea8408..a210035d2 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2019_08_12_072649) do +ActiveRecord::Schema.define(version: 2019_08_30_141257) do # These are extensions that must be enabled in order to support this database enable_extension "btree_gist"