Skip to content

Commit

Permalink
use primary key type
Browse files Browse the repository at this point in the history
  • Loading branch information
PHCsys committed Nov 27, 2024
1 parent 5c5011b commit fd456a7
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
class CreatePgSearchDocuments < ActiveRecord::Migration<%= migration_version %>
def up
say_with_time("Creating table for pg_search multisearch") do
create_table :pg_search_documents do |t|
create_table :pg_search_documents, id: primary_key_type do |t|
t.text :content
t.belongs_to :searchable, polymorphic: true, index: true
t.belongs_to :searchable, polymorphic: true, index: true, type: primary_key_type
t.timestamps null: false
end
end
Expand All @@ -14,4 +14,11 @@ class CreatePgSearchDocuments < ActiveRecord::Migration<%= migration_version %>
drop_table :pg_search_documents
end
end

private

def primary_key_type
config = Rails.configuration.generators
config.options[config.orm][:primary_key_type] || :primary_key
end
end

0 comments on commit fd456a7

Please sign in to comment.