From 1132af15151713f52d8d1e320271185865a79633 Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Sat, 16 Nov 2019 21:01:07 -0600 Subject: Moved to using a normalized text column for searches. Admins using an FTS-enabled version of Monsterfork will need to apply the migration from `dist/search.sql` then run `bundle exec rails monsterfork:index_statuses`. --- db/migrate/20191116233416_add_normalized_text_to_statuses.rb | 5 +++++ db/schema.rb | 9 ++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 db/migrate/20191116233416_add_normalized_text_to_statuses.rb (limited to 'db') diff --git a/db/migrate/20191116233416_add_normalized_text_to_statuses.rb b/db/migrate/20191116233416_add_normalized_text_to_statuses.rb new file mode 100644 index 000000000..655408a32 --- /dev/null +++ b/db/migrate/20191116233416_add_normalized_text_to_statuses.rb @@ -0,0 +1,5 @@ +class AddNormalizedTextToStatuses < ActiveRecord::Migration[5.2] + def change + add_column :statuses, :normalized_text, :text, null: false, default: '' + end +end diff --git a/db/schema.rb b/db/schema.rb index ee4778cbf..958a1dd49 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,10 +10,12 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2019_10_27_182731) do +ActiveRecord::Schema.define(version: 2019_11_16_233416) do # These are extensions that must be enabled in order to support this database + enable_extension "pg_trgm" enable_extension "plpgsql" + enable_extension "unaccent" create_table "account_conversations", force: :cascade do |t| t.bigint "account_id" @@ -697,9 +699,9 @@ ActiveRecord::Schema.define(version: 2019_10_27_182731) do t.boolean "edited" t.boolean "imported" t.string "origin" - t.tsvector "tsv" t.boolean "boostable" t.boolean "reject_replies" + t.text "normalized_text", default: "", null: false t.index ["account_id", "id", "visibility", "updated_at"], name: "index_statuses_20180106", order: { id: :desc } t.index ["account_id", "id", "visibility"], name: "index_statuses_on_account_id_and_id_and_visibility", order: { id: :desc }, where: "(visibility = ANY (ARRAY[0, 1, 2, 4]))" t.index ["in_reply_to_account_id"], name: "index_statuses_on_in_reply_to_account_id" @@ -707,7 +709,8 @@ ActiveRecord::Schema.define(version: 2019_10_27_182731) do t.index ["network"], name: "index_statuses_on_network", where: "network" t.index ["origin"], name: "index_statuses_on_origin", unique: true t.index ["reblog_of_id", "account_id"], name: "index_statuses_on_reblog_of_id_and_account_id" - t.index ["tsv"], name: "tsv_idx", using: :gin + t.index ["spoiler_text"], name: "index_statuses_on_spoiler_text_trgm", opclass: :gin_trgm_ops, using: :gin + t.index ["text"], name: "index_statuses_on_text_trgm", opclass: :gin_trgm_ops, using: :gin t.index ["uri"], name: "index_statuses_on_uri", unique: true end -- cgit