Oliver Günther 6 years ago
parent aa9d447287
commit 09e67a4a39
No known key found for this signature in database
GPG Key ID: A3A8BDAD7C0C552C
  1. 26
      db/migrate/20180122135443_add_tsv_columns_to_attachments.rb

@ -29,7 +29,7 @@
#++
class AddTsvColumnsToAttachments < ActiveRecord::Migration[5.0]
def change
def up
if OpenProject::Database.allows_tsv?
add_column :attachments, :fulltext_tsv, :tsvector
add_column :attachments, :file_tsv, :tsvector
@ -37,11 +37,25 @@ class AddTsvColumnsToAttachments < ActiveRecord::Migration[5.0]
add_index :attachments, :fulltext_tsv, using: "gin"
add_index :attachments, :file_tsv, using: "gin"
else
reversible do |dir|
dir.up do
warn "Your installation does not support full-text search features. Better use PostgreSQL in version 9.5 or higher."
end
end
warn "Your installation does not support full-text search features. Better use PostgreSQL in version 9.5 or higher."
end
end
def down
if column_exists? :attachments, :fulltext_tsv
remove_column :attachments, :fulltext_tsv, :tsvector
end
if column_exists? :attachments, :file_tsv
remove_column :attachments, :file_tsv, :tsvector
end
if index_exists? :attachments, :fulltext_tsv
remove_index :attachments, :fulltext_tsv
end
if index_exists? :attachments, :file_tsv
remove_index :attachments, :file_tsv
end
end
end

Loading…
Cancel
Save