Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge [5459] from trunk.

git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/1-2-pre-release@5460 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit cc299d1b948a1db045ce2a688d8b4e320037bd2e 1 parent cbffafb
@jeremy jeremy authored
View
2  activerecord/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Firebird: decimal/numeric support. #6408 [macrnic]
+
* make add_order a tad faster. #6567 [Stefan Kaes]
* Find with :include respects scoped :order. #5850
View
17 activerecord/lib/active_record/connection_adapters/firebird_adapter.rb
@@ -50,7 +50,7 @@ def initialize(name, domain, type, sub_type, length, precision, scale, default_s
@default = parse_default(default_source) if default_source
@limit = decide_limit(length)
- @domain, @sub_type, @precision, @scale = domain, sub_type, precision, scale
+ @domain, @sub_type, @precision, @scale = domain, sub_type, precision, scale.abs
end
def type
@@ -293,6 +293,8 @@ def native_database_types # :nodoc:
:string => { :name => "varchar", :limit => 255 },
:text => { :name => "blob sub_type text" },
:integer => { :name => "bigint" },
+ :decimal => { :name => "decimal" },
+ :numeric => { :name => "numeric" },
:float => { :name => "float" },
:datetime => { :name => "timestamp" },
:timestamp => { :name => "timestamp" },
@@ -534,12 +536,7 @@ def rename_column(table_name, column_name, new_column_name) # :nodoc:
end
def remove_index(table_name, options) #:nodoc:
- if Hash === options
- index_name = options[:name]
- else
- index_name = "#{table_name}_#{options}_index"
- end
- execute "DROP INDEX #{index_name}"
+ execute "DROP INDEX #{quote_column_name(index_name(table_name, options))}"
end
def rename_table(name, new_name) # :nodoc:
@@ -568,12 +565,12 @@ def dump_schema_information # :nodoc:
super << ";\n"
end
- def type_to_sql(type, limit = nil) # :nodoc:
+ def type_to_sql(type, limit = nil, precision = nil, scale = nil) # :nodoc:
case type
when :integer then integer_sql_type(limit)
when :float then float_sql_type(limit)
- when :string then super
- else super(type)
+ when :string then super(type, limit, precision, scale)
+ else super(type, limit, precision, scale)
end
end
View
2  activerecord/test/migration_test_firebird.rb
@@ -91,7 +91,7 @@ def test_rename_table_with_data_and_index
assert_nothing_raised { @connection.rename_table :foo, :bar }
assert !@connection.tables.include?("foo")
assert @connection.tables.include?("bar")
- assert_equal "bar_baz_index", @connection.indexes("bar").first.name
+ assert_equal "index_bar_on_baz", @connection.indexes("bar").first.name
assert_equal 100, FireRuby::Generator.new("bar_seq", @fireruby_connection).last
assert_equal 100, @connection.select_one("SELECT COUNT(*) FROM bar")["count"]
ensure
Please sign in to comment.
Something went wrong with that request. Please try again.