diff --git a/db/migrate/20241002103608_create_search_indexes.rb b/db/migrate/20241002103608_create_search_indexes.rb new file mode 100644 index 000000000..5933ffea3 --- /dev/null +++ b/db/migrate/20241002103608_create_search_indexes.rb @@ -0,0 +1,6 @@ +class CreateSearchIndexes < ActiveRecord::Migration[8.0] + def change + create_virtual_table :bubbles_search_index, "fts5", [ "title" ] + create_virtual_table :comments_search_index, "fts5", [ "body" ] + end +end diff --git a/db/schema.rb b/db/schema.rb index a3be4e1d7..5aa0a96c0 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[8.0].define(version: 2024_10_01_200953) do +ActiveRecord::Schema[8.0].define(version: 2024_10_02_103608) do create_table "accesses", force: :cascade do |t| t.integer "bucket_id", null: false t.integer "user_id", null: false @@ -148,4 +148,9 @@ ActiveRecord::Schema[8.0].define(version: 2024_10_01_200953) do add_foreign_key "taggings", "bubbles" add_foreign_key "taggings", "tags" add_foreign_key "users", "accounts" + + # Virtual tables defined in this database. + # Note that virtual tables may not work with other database engines. Be careful if changing database. + create_virtual_table "bubbles_search_index", "fts5", ["title"] + create_virtual_table "comments_search_index", "fts5", ["body"] end