Fix search_entries migration for PostgreSQL

1. rails dbconsole -p <<< "DELETE FROM schema_migrations WHERE version = '20250603105556';"
2. rails db:migrate

Confirm fix:
 1. rails dbconsole -p <<< "\dt search_entries"
 2. rails console
   > Template.first.destroy
pull/501/head
Ryan Arakawa 4 months ago
parent c6eac5d543
commit c69fdc496f

@ -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

@ -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'

@ -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"

Loading…
Cancel
Save