aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
diff options
context:
space:
mode:
authorBenjamin Fritsch <ben@lomography.com>2011-04-26 09:47:40 +0200
committerBenjamin Fritsch <ben@lomography.com>2011-04-26 09:47:40 +0200
commit714b4a82f43e3882516e81e8fac8da34e72b190e (patch)
treefa2fb7579a81bc8adb0f7d9bfcd92689cce1178e /activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
parent724a7866774c7847cc79b699ccf7da9fee72b154 (diff)
downloadrails-714b4a82f43e3882516e81e8fac8da34e72b190e.tar.gz
rails-714b4a82f43e3882516e81e8fac8da34e72b190e.tar.bz2
rails-714b4a82f43e3882516e81e8fac8da34e72b190e.zip
Added tsvector Datatype Support
Applied Patch from https://rails.lighthouseapp.com/projects/8994/tickets/5577-suport-from-tsvector-data-type-in-postgresql
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb')
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
index 66ca831d6c..4e6d9ae087 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -95,6 +95,9 @@ module ActiveRecord
# XML type
when 'xml'
:xml
+ # tsvector type
+ when 'tsvector'
+ :tsvector
# Arrays
when /^\D+\[\]$/
:string
@@ -186,6 +189,11 @@ module ActiveRecord
options = args.extract_options!
column(args[0], 'xml', options)
end
+
+ def tsvector(*args)
+ options = args.extract_options!
+ column(args[0], 'tsvector', options)
+ end
end
ADAPTER_NAME = 'PostgreSQL'
@@ -203,7 +211,8 @@ module ActiveRecord
:date => { :name => "date" },
:binary => { :name => "bytea" },
:boolean => { :name => "boolean" },
- :xml => { :name => "xml" }
+ :xml => { :name => "xml" },
+ :tsvector => { :name => "tsvector" }
}
# Returns 'PostgreSQL' as adapter name for identification purposes.