From aa38f7d6159574e3cfb3f2e313fa2c5e16e2ee1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Emin=20=C4=B0NA=C3=87?= Date: Sat, 6 Feb 2016 01:20:21 +0200 Subject: Added numeric helper into migrations. With this addition, you can add a column into the table like: ``` create_table(:numeric_types) do |t| t.numeric :foo, precision: 10, scale: 2, default: 2.0 end ``` The result of the migration above is same with: ``` create_table(:numeric_types) do |t| t.decimal :foo, precision: 10, scale: 2, default: 2.0 end ``` --- activerecord/CHANGELOG.md | 10 ++++++++++ .../connection_adapters/abstract/schema_definitions.rb | 2 ++ 2 files changed, 12 insertions(+) (limited to 'activerecord') diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 4ca33491aa..a25e850240 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,13 @@ +* Added `numeric` helper into migrations. + + Example: + + create_table(:numeric_types) do |t| + t.numeric :numeric_type, precision: 10, scale: 2 + end + + *Mehmet Emin İNAÇ* + * Bumped the minimum supported version of PostgreSQL to >= 9.1. Both PG 9.0 and 8.4 are past their end of life date: http://www.postgresql.org/support/versioning/ diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb index 690e0ba957..cb10ca9929 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb @@ -182,6 +182,7 @@ module ActiveRecord end CODE end + alias_method :numeric, :decimal end # Represents the schema of an SQL table in an abstract way. This class @@ -436,6 +437,7 @@ module ActiveRecord # t.bigint # t.float # t.decimal + # t.numeric # t.datetime # t.timestamp # t.time -- cgit v1.2.3