diff --git a/app/models/search_entry.rb b/app/models/search_entry.rb index dca2db05..bc641669 100644 --- a/app/models/search_entry.rb +++ b/app/models/search_entry.rb @@ -5,7 +5,6 @@ # Table name: search_entries # # id :bigint not null, primary key -# ngram :tsvector # record_type :string not null # tsvector :tsvector not null # created_at :datetime not null @@ -15,9 +14,6 @@ # # Indexes # -# index_search_entries_on_account_id_ngram_submission (account_id,ngram) WHERE ((record_type)::text = 'Submission'::text) USING gin -# index_search_entries_on_account_id_ngram_submitter (account_id,ngram) WHERE ((record_type)::text = 'Submitter'::text) USING gin -# index_search_entries_on_account_id_ngram_template (account_id,ngram) WHERE ((record_type)::text = 'Template'::text) USING gin # index_search_entries_on_account_id_tsvector_submission (account_id,tsvector) WHERE ((record_type)::text = 'Submission'::text) USING gin # index_search_entries_on_account_id_tsvector_submitter (account_id,tsvector) WHERE ((record_type)::text = 'Submitter'::text) USING gin # index_search_entries_on_account_id_tsvector_template (account_id,tsvector) WHERE ((record_type)::text = 'Template'::text) USING gin diff --git a/db/migrate/20250603105556_create_search_enties.rb b/db/migrate/20250603105556_create_search_entries.rb similarity index 95% rename from db/migrate/20250603105556_create_search_enties.rb rename to db/migrate/20250603105556_create_search_entries.rb index 2b219f84..75a007e8 100644 --- a/db/migrate/20250603105556_create_search_enties.rb +++ b/db/migrate/20250603105556_create_search_entries.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class CreateSearchEnties < ActiveRecord::Migration[8.0] +class CreateSearchEntries < ActiveRecord::Migration[8.0] def up return unless adapter_name == 'PostgreSQL' diff --git a/db/schema.rb b/db/schema.rb index 12ad3824..5e36884c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -12,6 +12,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_18_085322) do # These are extensions that must be enabled in order to support this database + enable_extension "btree_gin" enable_extension "pg_catalog.plpgsql" create_table "access_tokens", force: :cascade do |t| @@ -257,6 +258,19 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_18_085322) do t.index ["uid"], name: "index_oauth_applications_on_uid", unique: true end + create_table "search_entries", force: :cascade do |t| + t.string "record_type", null: false + t.bigint "record_id", null: false + t.bigint "account_id", null: false + t.tsvector "tsvector", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["account_id", "tsvector"], name: "index_search_entries_on_account_id_tsvector_submission", where: "((record_type)::text = 'Submission'::text)", using: :gin + t.index ["account_id", "tsvector"], name: "index_search_entries_on_account_id_tsvector_submitter", where: "((record_type)::text = 'Submitter'::text)", using: :gin + t.index ["account_id", "tsvector"], name: "index_search_entries_on_account_id_tsvector_template", where: "((record_type)::text = 'Template'::text)", using: :gin + t.index ["record_id", "record_type"], name: "index_search_entries_on_record_id_and_record_type", unique: true + end + create_table "submission_events", force: :cascade do |t| t.integer "submission_id", null: false t.integer "submitter_id"