mirror of
https://github.com/github/rails.git
synced 2026-01-30 16:58:15 -05:00
Firebird: decimal/numeric support. Closes #6408.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5459 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -50,7 +50,7 @@ module ActiveRecord
|
||||
|
||||
@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 @@ module ActiveRecord
|
||||
: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 @@ module ActiveRecord
|
||||
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 @@ module ActiveRecord
|
||||
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 @@ class FirebirdMigrationTest < Test::Unit::TestCase
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user