diff options
author | Dan McClain <git@danseaver.com> | 2012-08-19 18:02:34 -0400 |
---|---|---|
committer | Dan McClain <git@danseaver.com> | 2012-09-14 08:43:47 -0400 |
commit | 4544d2bc90bea93c38bb21d912dba00f51cf620f (patch) | |
tree | 44a38fe8ba8c2d8ca1c62839a973557fe2278c0d /activerecord/CHANGELOG.md | |
parent | 84ba499b1645230dd90f46fa63e5d071ada49f37 (diff) | |
download | rails-4544d2bc90bea93c38bb21d912dba00f51cf620f.tar.gz rails-4544d2bc90bea93c38bb21d912dba00f51cf620f.tar.bz2 rails-4544d2bc90bea93c38bb21d912dba00f51cf620f.zip |
Moves column dump specific code to a module included in AbstractAdapter
Having column related schema dumper code in the AbstractAdapter. The
code remains the same, but by placing it in the AbstractAdapter, we can
then overwrite it with Adapter specific methods that will help with
Adapter specific data types.
The goal of moving this code here is to create a new migration key for
PostgreSQL's array type. Since any datatype can be an array, the goal is
to have ':array => true' as a migration option, turning the datatype
into an array. I've implemented this in postgres_ext, the syntax is
shown here: https://github.com/dockyard/postgres_ext#arrays
Adds array migration support
Adds array_test.rb outlining the test cases for array data type
Adds pg_array_parser to Gemfile for testing
Adds pg_array_parser to postgresql_adapter (unused in this commit)
Adds schema dump support for arrays
Adds postgres array type casting support
Updates changelog, adds note for inet and cidr support, which I forgot to add before
Removing debugger, Adds pg_array_parser to JRuby platform
Removes pg_array_parser requirement, creates ArrayParser module used by
PostgreSQLAdapter
Diffstat (limited to 'activerecord/CHANGELOG.md')
-rw-r--r-- | activerecord/CHANGELOG.md | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 8c99a3929e..475c237009 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -23,6 +23,37 @@ *kennyj* +* PostgreSQL inet and cidr types are converted to `IPAddr` objects. + *Dan McClain* + +* PostgreSQL array type support. Any datatype can be used to create an + array column, with full migration and schema dumper support. + + To declare an array column, use the following syntax: + + create_table :table_with_arrays do |t| + t.integer :int_array, :array => true + # integer[] + t.integer :int_array, :array => true, :length => 2 + # smallint[] + t.string :string_array, :array => true, :length => 30 + # char varying(30)[] + end + + This respects any other migraion detail (limits, defaults, etc). + ActiveRecord will serialize and deserialize the array columns on + their way to and from the database. + + One thing to note: PostgreSQL does not enforce any limits on the + number of elements, and any array can be multi-dimensional. Any + array that is multi-dimensional must be rectangular (each sub array + must have the same number of elements as its siblings). + + If the `pg_array_parser` gem is available, it will be used when + parsing PostgreSQL's array representation + + *Dan McClain* + * Attribute predicate methods, such as `article.title?`, will now raise `ActiveModel::MissingAttributeError` if the attribute being queried for truthiness was not read from the database, instead of just returning false. |