about summary refs log tree commit diff
path: root/db
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2019-11-16 21:01:07 -0600
committermultiple creatures <dev@multiple-creature.party>2019-11-16 21:01:07 -0600
commit1132af15151713f52d8d1e320271185865a79633 (patch)
treec7d5dd6afb7a60c840a0d3238124f01c747eada8 /db
parent487c945d160e9349579bf541147c949f8bca3c46 (diff)
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`.
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20191116233416_add_normalized_text_to_statuses.rb5
-rw-r--r--db/schema.rb9
2 files changed, 11 insertions, 3 deletions
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