1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-17 06:52:27 +01:00

using unaccent to build project search index + updated doc

This commit is contained in:
Sylvain 2020-06-30 15:58:39 +02:00
parent 045462f51f
commit e644e4894a
5 changed files with 93 additions and 91 deletions

View File

@ -70,7 +70,7 @@ class Project < ApplicationRecord
}, },
trigram: { trigram: {
word_similarity: true, word_similarity: true,
threshold: 0.5 threshold: 0.3
}, },
dmetaphone: {} dmetaphone: {}
}, },

View File

@ -16,11 +16,11 @@ class UpdateSearchVectorOfProjects < ActiveRecord::Migration[5.2]
select string_agg(description, ' ') as content into step_description from project_steps where project_id = new.id; select string_agg(description, ' ') as content into step_description from project_steps where project_id = new.id;
new.search_vector := new.search_vector :=
setweight(to_tsvector('pg_catalog.#{Rails.application.secrets.postgresql_language_analyzer}', coalesce(new.name, '')), 'A') || setweight(to_tsvector('pg_catalog.#{Rails.application.secrets.postgresql_language_analyzer}', unaccent(coalesce(new.name, ''))), 'A') ||
setweight(to_tsvector('pg_catalog.#{Rails.application.secrets.postgresql_language_analyzer}', coalesce(new.tags, '')), 'B') || setweight(to_tsvector('pg_catalog.#{Rails.application.secrets.postgresql_language_analyzer}', unaccent(coalesce(new.tags, ''))), 'B') ||
setweight(to_tsvector('pg_catalog.#{Rails.application.secrets.postgresql_language_analyzer}', coalesce(new.description, '')), 'D') || setweight(to_tsvector('pg_catalog.#{Rails.application.secrets.postgresql_language_analyzer}', unaccent(coalesce(new.description, ''))), 'D') ||
setweight(to_tsvector('pg_catalog.#{Rails.application.secrets.postgresql_language_analyzer}', coalesce(step_title.title, '')), 'C') || setweight(to_tsvector('pg_catalog.#{Rails.application.secrets.postgresql_language_analyzer}', unaccent(coalesce(step_title.title, ''))), 'C') ||
setweight(to_tsvector('pg_catalog.#{Rails.application.secrets.postgresql_language_analyzer}', coalesce(step_description.content, '')), 'D'); setweight(to_tsvector('pg_catalog.#{Rails.application.secrets.postgresql_language_analyzer}', unaccent(coalesce(step_description.content, ''))), 'D');
return new; return new;
end end

View File

@ -4,18 +4,18 @@
# This will enable the function word_similarity(text, text) for the project's full-text searches # This will enable the function word_similarity(text, text) for the project's full-text searches
class UpdatePgTrgm < ActiveRecord::Migration[5.2] class UpdatePgTrgm < ActiveRecord::Migration[5.2]
# PostgreSQL only # PostgreSQL only
def change def up
say_with_time('Upgrade extension :pg_trgm') do say_with_time('Upgrade extension :pg_trgm') do
execute <<~SQL execute <<~SQL
DROP INDEX profiles_lower_unaccent_first_name_trgm_idx; ALTER EXTENSION pg_trgm UPDATE;
DROP INDEX profiles_lower_unaccent_last_name_trgm_idx;
DROP EXTENSION pg_trgm;
CREATE EXTENSION IF NOT EXISTS pg_trgm;
CREATE INDEX profiles_lower_unaccent_first_name_trgm_idx ON profiles
USING gin (lower(f_unaccent(first_name)) gin_trgm_ops);
CREATE INDEX profiles_lower_unaccent_last_name_trgm_idx ON profiles
USING gin (lower(f_unaccent(last_name)) gin_trgm_ops);
SQL SQL
end end
end end
def down
# we cannot downgrade a postgresSQL extension, so we do notinf
execute <<~SQL
ALTER EXTENSION pg_trgm UPDATE;
SQL
end
end end

View File

@ -78,11 +78,11 @@ CREATE FUNCTION public.fill_search_vector_for_project() RETURNS trigger
select string_agg(description, ' ') as content into step_description from project_steps where project_id = new.id; select string_agg(description, ' ') as content into step_description from project_steps where project_id = new.id;
new.search_vector := new.search_vector :=
setweight(to_tsvector('pg_catalog.french', coalesce(new.name, '')), 'A') || setweight(to_tsvector('pg_catalog.french', unaccent(coalesce(new.name, ''))), 'A') ||
setweight(to_tsvector('pg_catalog.french', coalesce(new.tags, '')), 'B') || setweight(to_tsvector('pg_catalog.french', unaccent(coalesce(new.tags, ''))), 'B') ||
setweight(to_tsvector('pg_catalog.french', coalesce(new.description, '')), 'D') || setweight(to_tsvector('pg_catalog.french', unaccent(coalesce(new.description, ''))), 'D') ||
setweight(to_tsvector('pg_catalog.french', coalesce(step_title.title, '')), 'C') || setweight(to_tsvector('pg_catalog.french', unaccent(coalesce(step_title.title, ''))), 'C') ||
setweight(to_tsvector('pg_catalog.french', coalesce(step_description.content, '')), 'D'); setweight(to_tsvector('pg_catalog.french', unaccent(coalesce(step_description.content, ''))), 'D');
return new; return new;
end end
@ -181,14 +181,14 @@ ALTER SEQUENCE public.accounting_periods_id_seq OWNED BY public.accounting_perio
CREATE TABLE public.addresses ( CREATE TABLE public.addresses (
id integer NOT NULL, id integer NOT NULL,
address character varying(255), address character varying,
street_number character varying(255), street_number character varying,
route character varying(255), route character varying,
locality character varying(255), locality character varying,
country character varying(255), country character varying,
postal_code character varying(255), postal_code character varying,
placeable_id integer, placeable_id integer,
placeable_type character varying(255), placeable_type character varying,
created_at timestamp without time zone, created_at timestamp without time zone,
updated_at timestamp without time zone updated_at timestamp without time zone
); );
@ -264,9 +264,9 @@ CREATE TABLE public.ar_internal_metadata (
CREATE TABLE public.assets ( CREATE TABLE public.assets (
id integer NOT NULL, id integer NOT NULL,
viewable_id integer, viewable_id integer,
viewable_type character varying(255), viewable_type character varying,
attachment character varying(255), attachment character varying,
type character varying(255), type character varying,
created_at timestamp without time zone, created_at timestamp without time zone,
updated_at timestamp without time zone updated_at timestamp without time zone
); );
@ -333,7 +333,7 @@ CREATE TABLE public.availabilities (
id integer NOT NULL, id integer NOT NULL,
start_at timestamp without time zone, start_at timestamp without time zone,
end_at timestamp without time zone, end_at timestamp without time zone,
available_type character varying(255), available_type character varying,
created_at timestamp without time zone, created_at timestamp without time zone,
updated_at timestamp without time zone, updated_at timestamp without time zone,
nb_total_places integer, nb_total_places integer,
@ -405,7 +405,7 @@ ALTER SEQUENCE public.availability_tags_id_seq OWNED BY public.availability_tags
CREATE TABLE public.categories ( CREATE TABLE public.categories (
id integer NOT NULL, id integer NOT NULL,
name character varying(255), name character varying,
created_at timestamp without time zone, created_at timestamp without time zone,
updated_at timestamp without time zone, updated_at timestamp without time zone,
slug character varying slug character varying
@ -437,7 +437,7 @@ ALTER SEQUENCE public.categories_id_seq OWNED BY public.categories.id;
CREATE TABLE public.components ( CREATE TABLE public.components (
id integer NOT NULL, id integer NOT NULL,
name character varying(255) NOT NULL name character varying NOT NULL
); );
@ -505,7 +505,7 @@ ALTER SEQUENCE public.coupons_id_seq OWNED BY public.coupons.id;
CREATE TABLE public.credits ( CREATE TABLE public.credits (
id integer NOT NULL, id integer NOT NULL,
creditable_id integer, creditable_id integer,
creditable_type character varying(255), creditable_type character varying,
plan_id integer, plan_id integer,
hours integer, hours integer,
created_at timestamp without time zone, created_at timestamp without time zone,
@ -664,7 +664,7 @@ ALTER SEQUENCE public.event_themes_id_seq OWNED BY public.event_themes.id;
CREATE TABLE public.events ( CREATE TABLE public.events (
id integer NOT NULL, id integer NOT NULL,
title character varying(255), title character varying,
description text, description text,
created_at timestamp without time zone, created_at timestamp without time zone,
updated_at timestamp without time zone, updated_at timestamp without time zone,
@ -769,10 +769,10 @@ ALTER SEQUENCE public.exports_id_seq OWNED BY public.exports.id;
CREATE TABLE public.friendly_id_slugs ( CREATE TABLE public.friendly_id_slugs (
id integer NOT NULL, id integer NOT NULL,
slug character varying(255) NOT NULL, slug character varying NOT NULL,
sluggable_id integer NOT NULL, sluggable_id integer NOT NULL,
sluggable_type character varying(50), sluggable_type character varying(50),
scope character varying(255), scope character varying,
created_at timestamp without time zone created_at timestamp without time zone
); );
@ -802,10 +802,10 @@ ALTER SEQUENCE public.friendly_id_slugs_id_seq OWNED BY public.friendly_id_slugs
CREATE TABLE public.groups ( CREATE TABLE public.groups (
id integer NOT NULL, id integer NOT NULL,
name character varying(255), name character varying,
created_at timestamp without time zone, created_at timestamp without time zone,
updated_at timestamp without time zone, updated_at timestamp without time zone,
slug character varying(255), slug character varying,
disabled boolean disabled boolean
); );
@ -977,7 +977,7 @@ ALTER SEQUENCE public.imports_id_seq OWNED BY public.imports.id;
CREATE TABLE public.invoice_items ( CREATE TABLE public.invoice_items (
id integer NOT NULL, id integer NOT NULL,
invoice_id integer, invoice_id integer,
stp_invoice_item_id character varying(255), stp_invoice_item_id character varying,
amount integer, amount integer,
created_at timestamp without time zone, created_at timestamp without time zone,
updated_at timestamp without time zone, updated_at timestamp without time zone,
@ -1014,16 +1014,16 @@ ALTER SEQUENCE public.invoice_items_id_seq OWNED BY public.invoice_items.id;
CREATE TABLE public.invoices ( CREATE TABLE public.invoices (
id integer NOT NULL, id integer NOT NULL,
invoiced_id integer, invoiced_id integer,
invoiced_type character varying(255), invoiced_type character varying,
stp_invoice_id character varying(255), stp_invoice_id character varying,
total integer, total integer,
created_at timestamp without time zone, created_at timestamp without time zone,
updated_at timestamp without time zone, updated_at timestamp without time zone,
reference character varying(255), reference character varying,
payment_method character varying(255), payment_method character varying,
avoir_date timestamp without time zone, avoir_date timestamp without time zone,
invoice_id integer, invoice_id integer,
type character varying(255), type character varying,
subscription_to_expire boolean, subscription_to_expire boolean,
description text, description text,
wallet_amount integer, wallet_amount integer,
@ -1097,7 +1097,7 @@ ALTER SEQUENCE public.invoicing_profiles_id_seq OWNED BY public.invoicing_profil
CREATE TABLE public.licences ( CREATE TABLE public.licences (
id integer NOT NULL, id integer NOT NULL,
name character varying(255) NOT NULL, name character varying NOT NULL,
description text description text
); );
@ -1127,12 +1127,12 @@ ALTER SEQUENCE public.licences_id_seq OWNED BY public.licences.id;
CREATE TABLE public.machines ( CREATE TABLE public.machines (
id integer NOT NULL, id integer NOT NULL,
name character varying(255) NOT NULL, name character varying NOT NULL,
description text, description text,
spec text, spec text,
created_at timestamp without time zone, created_at timestamp without time zone,
updated_at timestamp without time zone, updated_at timestamp without time zone,
slug character varying(255), slug character varying,
disabled boolean disabled boolean
); );
@ -1194,7 +1194,7 @@ CREATE TABLE public.notifications (
id integer NOT NULL, id integer NOT NULL,
receiver_id integer, receiver_id integer,
attached_object_id integer, attached_object_id integer,
attached_object_type character varying(255), attached_object_type character varying,
notification_type_id integer, notification_type_id integer,
is_read boolean DEFAULT false, is_read boolean DEFAULT false,
created_at timestamp without time zone, created_at timestamp without time zone,
@ -1434,11 +1434,11 @@ ALTER SEQUENCE public.organizations_id_seq OWNED BY public.organizations.id;
CREATE TABLE public.plans ( CREATE TABLE public.plans (
id integer NOT NULL, id integer NOT NULL,
name character varying(255), name character varying,
amount integer, amount integer,
"interval" character varying(255), "interval" character varying,
group_id integer, group_id integer,
stp_plan_id character varying(255), stp_plan_id character varying,
created_at timestamp without time zone, created_at timestamp without time zone,
updated_at timestamp without time zone, updated_at timestamp without time zone,
training_credit_nb integer DEFAULT 0, training_credit_nb integer DEFAULT 0,
@ -1576,9 +1576,9 @@ ALTER SEQUENCE public.prices_id_seq OWNED BY public.prices.id;
CREATE TABLE public.profiles ( CREATE TABLE public.profiles (
id integer NOT NULL, id integer NOT NULL,
user_id integer, user_id integer,
first_name character varying(255), first_name character varying,
last_name character varying(255), last_name character varying,
phone character varying(255), phone character varying,
interest text, interest text,
software_mastered text, software_mastered text,
created_at timestamp without time zone, created_at timestamp without time zone,
@ -1632,7 +1632,7 @@ CREATE TABLE public.project_steps (
project_id integer, project_id integer,
created_at timestamp without time zone, created_at timestamp without time zone,
updated_at timestamp without time zone, updated_at timestamp without time zone,
title character varying(255), title character varying,
step_nb integer step_nb integer
); );
@ -1667,7 +1667,7 @@ CREATE TABLE public.project_users (
created_at timestamp without time zone, created_at timestamp without time zone,
updated_at timestamp without time zone, updated_at timestamp without time zone,
is_valid boolean DEFAULT false, is_valid boolean DEFAULT false,
valid_token character varying(255) valid_token character varying
); );
@ -1696,14 +1696,14 @@ ALTER SEQUENCE public.project_users_id_seq OWNED BY public.project_users.id;
CREATE TABLE public.projects ( CREATE TABLE public.projects (
id integer NOT NULL, id integer NOT NULL,
name character varying(255), name character varying,
description text, description text,
created_at timestamp without time zone, created_at timestamp without time zone,
updated_at timestamp without time zone, updated_at timestamp without time zone,
tags text, tags text,
licence_id integer, licence_id integer,
state character varying(255), state character varying,
slug character varying(255), slug character varying,
published_at timestamp without time zone, published_at timestamp without time zone,
author_statistic_profile_id integer, author_statistic_profile_id integer,
search_vector tsvector search_vector tsvector
@ -1859,7 +1859,7 @@ CREATE TABLE public.reservations (
created_at timestamp without time zone, created_at timestamp without time zone,
updated_at timestamp without time zone, updated_at timestamp without time zone,
reservable_id integer, reservable_id integer,
reservable_type character varying(255), reservable_type character varying,
nb_reserve_places integer, nb_reserve_places integer,
statistic_profile_id integer statistic_profile_id integer
); );
@ -1890,9 +1890,9 @@ ALTER SEQUENCE public.reservations_id_seq OWNED BY public.reservations.id;
CREATE TABLE public.roles ( CREATE TABLE public.roles (
id integer NOT NULL, id integer NOT NULL,
name character varying(255), name character varying,
resource_id integer, resource_id integer,
resource_type character varying(255), resource_type character varying,
created_at timestamp without time zone, created_at timestamp without time zone,
updated_at timestamp without time zone updated_at timestamp without time zone
); );
@ -1922,7 +1922,7 @@ ALTER SEQUENCE public.roles_id_seq OWNED BY public.roles.id;
-- --
CREATE TABLE public.schema_migrations ( CREATE TABLE public.schema_migrations (
version character varying(255) NOT NULL version character varying NOT NULL
); );
@ -2135,11 +2135,11 @@ ALTER SEQUENCE public.statistic_custom_aggregations_id_seq OWNED BY public.stati
CREATE TABLE public.statistic_fields ( CREATE TABLE public.statistic_fields (
id integer NOT NULL, id integer NOT NULL,
statistic_index_id integer, statistic_index_id integer,
key character varying(255), key character varying,
label character varying(255), label character varying,
created_at timestamp without time zone, created_at timestamp without time zone,
updated_at timestamp without time zone, updated_at timestamp without time zone,
data_type character varying(255) data_type character varying
); );
@ -2169,7 +2169,7 @@ ALTER SEQUENCE public.statistic_fields_id_seq OWNED BY public.statistic_fields.i
CREATE TABLE public.statistic_graphs ( CREATE TABLE public.statistic_graphs (
id integer NOT NULL, id integer NOT NULL,
statistic_index_id integer, statistic_index_id integer,
chart_type character varying(255), chart_type character varying,
"limit" integer, "limit" integer,
created_at timestamp without time zone, created_at timestamp without time zone,
updated_at timestamp without time zone updated_at timestamp without time zone
@ -2201,8 +2201,8 @@ ALTER SEQUENCE public.statistic_graphs_id_seq OWNED BY public.statistic_graphs.i
CREATE TABLE public.statistic_indices ( CREATE TABLE public.statistic_indices (
id integer NOT NULL, id integer NOT NULL,
es_type_key character varying(255), es_type_key character varying,
label character varying(255), label character varying,
created_at timestamp without time zone, created_at timestamp without time zone,
updated_at timestamp without time zone, updated_at timestamp without time zone,
"table" boolean DEFAULT true, "table" boolean DEFAULT true,
@ -2302,8 +2302,8 @@ ALTER SEQUENCE public.statistic_profiles_id_seq OWNED BY public.statistic_profil
CREATE TABLE public.statistic_sub_types ( CREATE TABLE public.statistic_sub_types (
id integer NOT NULL, id integer NOT NULL,
key character varying(255), key character varying,
label character varying(255), label character varying,
created_at timestamp without time zone, created_at timestamp without time zone,
updated_at timestamp without time zone updated_at timestamp without time zone
); );
@ -2367,8 +2367,8 @@ ALTER SEQUENCE public.statistic_type_sub_types_id_seq OWNED BY public.statistic_
CREATE TABLE public.statistic_types ( CREATE TABLE public.statistic_types (
id integer NOT NULL, id integer NOT NULL,
statistic_index_id integer, statistic_index_id integer,
key character varying(255), key character varying,
label character varying(255), label character varying,
graph boolean, graph boolean,
created_at timestamp without time zone, created_at timestamp without time zone,
updated_at timestamp without time zone, updated_at timestamp without time zone,
@ -2434,7 +2434,7 @@ ALTER SEQUENCE public.stylesheets_id_seq OWNED BY public.stylesheets.id;
CREATE TABLE public.subscriptions ( CREATE TABLE public.subscriptions (
id integer NOT NULL, id integer NOT NULL,
plan_id integer, plan_id integer,
stp_subscription_id character varying(255), stp_subscription_id character varying,
created_at timestamp without time zone, created_at timestamp without time zone,
updated_at timestamp without time zone, updated_at timestamp without time zone,
expiration_date timestamp without time zone, expiration_date timestamp without time zone,
@ -2499,7 +2499,7 @@ ALTER SEQUENCE public.tags_id_seq OWNED BY public.tags.id;
CREATE TABLE public.themes ( CREATE TABLE public.themes (
id integer NOT NULL, id integer NOT NULL,
name character varying(255) NOT NULL name character varying NOT NULL
); );
@ -2561,11 +2561,11 @@ ALTER SEQUENCE public.tickets_id_seq OWNED BY public.tickets.id;
CREATE TABLE public.trainings ( CREATE TABLE public.trainings (
id integer NOT NULL, id integer NOT NULL,
name character varying(255), name character varying,
created_at timestamp without time zone, created_at timestamp without time zone,
updated_at timestamp without time zone, updated_at timestamp without time zone,
nb_total_places integer, nb_total_places integer,
slug character varying(255), slug character varying,
description text, description text,
public_page boolean DEFAULT true, public_page boolean DEFAULT true,
disabled boolean disabled boolean
@ -2724,28 +2724,28 @@ ALTER SEQUENCE public.user_tags_id_seq OWNED BY public.user_tags.id;
CREATE TABLE public.users ( CREATE TABLE public.users (
id integer NOT NULL, id integer NOT NULL,
email character varying(255) DEFAULT ''::character varying NOT NULL, email character varying DEFAULT ''::character varying NOT NULL,
encrypted_password character varying(255) DEFAULT ''::character varying NOT NULL, encrypted_password character varying DEFAULT ''::character varying NOT NULL,
reset_password_token character varying(255), reset_password_token character varying,
reset_password_sent_at timestamp without time zone, reset_password_sent_at timestamp without time zone,
remember_created_at timestamp without time zone, remember_created_at timestamp without time zone,
sign_in_count integer DEFAULT 0 NOT NULL, sign_in_count integer DEFAULT 0 NOT NULL,
current_sign_in_at timestamp without time zone, current_sign_in_at timestamp without time zone,
last_sign_in_at timestamp without time zone, last_sign_in_at timestamp without time zone,
confirmation_token character varying(255), confirmation_token character varying,
confirmed_at timestamp without time zone, confirmed_at timestamp without time zone,
confirmation_sent_at timestamp without time zone, confirmation_sent_at timestamp without time zone,
unconfirmed_email character varying(255), unconfirmed_email character varying,
failed_attempts integer DEFAULT 0 NOT NULL, failed_attempts integer DEFAULT 0 NOT NULL,
unlock_token character varying(255), unlock_token character varying,
locked_at timestamp without time zone, locked_at timestamp without time zone,
created_at timestamp without time zone, created_at timestamp without time zone,
updated_at timestamp without time zone, updated_at timestamp without time zone,
is_allow_contact boolean DEFAULT true, is_allow_contact boolean DEFAULT true,
group_id integer, group_id integer,
stp_customer_id character varying(255), stp_customer_id character varying,
username character varying(255), username character varying,
slug character varying(255), slug character varying,
is_active boolean DEFAULT true, is_active boolean DEFAULT true,
provider character varying, provider character varying,
uid character varying, uid character varying,
@ -4470,7 +4470,7 @@ CREATE INDEX index_projects_machines_on_project_id ON public.projects_machines U
-- Name: index_projects_on_slug; Type: INDEX; Schema: public; Owner: - -- Name: index_projects_on_slug; Type: INDEX; Schema: public; Owner: -
-- --
CREATE INDEX index_projects_on_slug ON public.projects USING btree (slug); CREATE UNIQUE INDEX index_projects_on_slug ON public.projects USING btree (slug);
-- --
@ -4502,10 +4502,10 @@ CREATE INDEX index_projects_themes_on_theme_id ON public.projects_themes USING b
-- --
-- Name: index_reservations_on_reservable_id_and_reservable_type; Type: INDEX; Schema: public; Owner: - -- Name: index_reservations_on_reservable_type_and_reservable_id; Type: INDEX; Schema: public; Owner: -
-- --
CREATE INDEX index_reservations_on_reservable_id_and_reservable_type ON public.reservations USING btree (reservable_id, reservable_type); CREATE INDEX index_reservations_on_reservable_type_and_reservable_id ON public.reservations USING btree (reservable_type, reservable_id);
-- --
@ -5617,7 +5617,6 @@ INSERT INTO "schema_migrations" (version) VALUES
('20200622135401'), ('20200622135401'),
('20200623134900'), ('20200623134900'),
('20200623141305'), ('20200623141305'),
('20200629114319'),
('20200629123011'); ('20200629123011');

View File

@ -76,3 +76,6 @@ This is currently not supported, because of some PostgreSQL specific instruction
- `db/migrate/20200511075933_fix_accounting_periods.rb` is using `CREATE RULE` and `DROP RULE`; - `db/migrate/20200511075933_fix_accounting_periods.rb` is using `CREATE RULE` and `DROP RULE`;
- `app/models/project.rb` is using the `pg_search` gem. - `app/models/project.rb` is using the `pg_search` gem.
- `db/migrate/20200622135401_add_pg_search_dmetaphone_support_functions.rb` is using [fuzzystrmatch](http://www.postgresql.org/docs/current/static/fuzzystrmatch.html) module and defines a PL/pgSQL function (`pg_search_dmetaphone()`); - `db/migrate/20200622135401_add_pg_search_dmetaphone_support_functions.rb` is using [fuzzystrmatch](http://www.postgresql.org/docs/current/static/fuzzystrmatch.html) module and defines a PL/pgSQL function (`pg_search_dmetaphone()`);
- `db/migrate/20200623134900_add_search_vector_to_project.rb` is using [tsvector](https://www.postgresql.org/docs/10/datatype-textsearch.html), a PostgreSQL datatype and [GIN (Generalized Inverted Index)](https://www.postgresql.org/docs/9.1/textsearch-indexes.html) a PostgreSQL index type;
- `db/migrate/20200623141305_update_search_vector_of_projects.rb` is defines a PL/pgSQL function (`fill_search_vector_for_project()`) and create an SQL trigger for this function;
- `db/migrate/20200629123011_update_pg_trgm.rb` is using [ALTER EXTENSION](https://www.postgresql.org/docs/10/sql-alterextension.html);