diff --git a/lib/pg_search/migration/templates/create_pg_search_documents.rb.erb b/lib/pg_search/migration/templates/create_pg_search_documents.rb.erb index 3d79ddbe..41494c35 100644 --- a/lib/pg_search/migration/templates/create_pg_search_documents.rb.erb +++ b/lib/pg_search/migration/templates/create_pg_search_documents.rb.erb @@ -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 @@ -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