Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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