diff options
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/postgresql/column.rb')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql/column.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/column.rb b/activerecord/lib/active_record/connection_adapters/postgresql/column.rb new file mode 100644 index 0000000000..acb1278499 --- /dev/null +++ b/activerecord/lib/active_record/connection_adapters/postgresql/column.rb @@ -0,0 +1,23 @@ +module ActiveRecord + module ConnectionAdapters + # PostgreSQL-specific extensions to column definitions in a table. + class PostgreSQLColumn < Column #:nodoc: + attr_reader :array + alias :array? :array + + def initialize(name, default, cast_type, sql_type = nil, null = true, default_function = nil) + if sql_type =~ /\[\]$/ + @array = true + sql_type = sql_type[0..sql_type.length - 3] + else + @array = false + end + super + end + + def serial? + default_function && default_function =~ /\Anextval\(.*\)\z/ + end + end + end +end |