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 56737c0ae4..2c0f739752 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
@@ -249,6 +249,7 @@ module ActiveRecord
define_column_methods :bigint, :binary, :boolean, :date, :datetime, :decimal,
:float, :integer, :json, :string, :text, :time, :timestamp, :virtual
+ alias :blob :binary
alias :numeric :decimal
end
@@ -564,6 +565,7 @@ module ActiveRecord
# t.time
# t.date
# t.binary
+ # t.blob
# t.boolean
# t.foreign_key
# t.json
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
index 0c5cdf62e4..bbdd19ca89 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
@@ -523,7 +523,7 @@ module ActiveRecord
# :primary_key, :string, :text,
# :integer, :bigint, :float, :decimal, :numeric,
# :datetime, :time, :date,
- # :binary, :boolean.
+ # :binary, :blob, :boolean.
#
# You may use a type not in this list as long as it is supported by your
# database (for example, "polygon" in MySQL), but this will not be database
@@ -532,7 +532,7 @@ module ActiveRecord
# Available options are (none of these exists by default):
# * :limit -
# Requests a maximum column length. This is the number of characters for a :string column
- # and number of bytes for :text, :binary, and :integer columns.
+ # and number of bytes for :text, :binary, :blob, and :integer columns.
# This option is ignored by some backends.
# * :default -
# The column's default value. Use +nil+ for +NULL+.
diff --git a/activerecord/test/cases/schema_dumper_test.rb b/activerecord/test/cases/schema_dumper_test.rb
index 346f9a5e77..547a685866 100644
--- a/activerecord/test/cases/schema_dumper_test.rb
+++ b/activerecord/test/cases/schema_dumper_test.rb
@@ -238,6 +238,12 @@ class SchemaDumperTest < ActiveRecord::TestCase
assert_match %r{t\.float\s+"temperature"$}, output
end
+ def test_schema_dump_aliased_types
+ output = standard_dump
+ assert_match %r{t\.binary\s+"blob_data"$}, output
+ assert_match %r{t\.decimal\s+"numeric_number"}, output
+ end
+
if ActiveRecord::Base.connection.supports_expression_index?
def test_schema_dump_expression_indices
index_definition = dump_table_schema("companies").split(/\n/).grep(/t\.index.*company_expression_index/).first.strip
diff --git a/activerecord/test/schema/schema.rb b/activerecord/test/schema/schema.rb
index 02b75a24e4..31de9c9fc3 100644
--- a/activerecord/test/schema/schema.rb
+++ b/activerecord/test/schema/schema.rb
@@ -86,6 +86,7 @@ ActiveRecord::Schema.define do
t.string :name
t.binary :data
t.binary :short_data, limit: 2048
+ t.blob :blob_data
end
create_table :birds, force: true do |t|
@@ -652,6 +653,7 @@ ActiveRecord::Schema.define do
t.decimal :my_house_population, precision: 2, scale: 0
t.decimal :decimal_number
t.decimal :decimal_number_with_default, precision: 3, scale: 2, default: 2.78
+ t.numeric :numeric_number
t.float :temperature
t.decimal :decimal_number_big_precision, precision: 20
# Oracle/SQLServer supports precision up to 38