提交 66b92abf 编写于 作者: J Jeremy Kemper

Firebird: decimal/numeric support. Closes #6408.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5459 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 fbccde94
*SVN*
* Firebird: decimal/numeric support. #6408 [macrnic]
* make add_order a tad faster. #6567 [Stefan Kaes]
* Find with :include respects scoped :order. #5850
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册