Skip to content

Commit

Permalink
don't specify column type in schema dump for NUMBER virtual columns
Browse files Browse the repository at this point in the history
  • Loading branch information
substars committed Nov 27, 2012
1 parent 7c54ebc commit e897d63
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def oracle_enhanced_table(table, stream)
spec[:name] = column.name.inspect
spec[:type] = column.virtual? ? 'virtual' : column.type.to_s
spec[:type] = column.virtual? ? 'virtual' : column.type.to_s
spec[:virtual_type] = column.type.inspect if column.virtual?
spec[:virtual_type] = column.type.inspect if column.virtual? && column.sql_type != 'NUMBER'
spec[:limit] = column.limit.inspect if column.limit != @types[column.type][:limit] && column.type != :decimal
spec[:precision] = column.precision.inspect if !column.precision.nil?
spec[:scale] = column.scale.inspect if !column.scale.nil?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ def drop_test_posts_table
t.virtual :full_name, :as => "first_name || ', ' || last_name"
t.virtual :short_name, :as => "COALESCE(first_name, last_name)", :type => :string, :limit => 300
t.virtual :abbrev_name, :as => "SUBSTR(first_name,1,50) || ' ' || SUBSTR(last_name,1,1) || '.'", :type => "VARCHAR(100)"
t.virtual :name_ratio, :as=>'(LENGTH(first_name)*10/LENGTH(last_name)*10)'
t.column :full_name_length, :virtual, :as => "length(first_name || ', ' || last_name)", :type => :integer
t.virtual :field_with_leading_space, :as => "' ' || first_name || ' '", :limit => 300, :type => :string
end
Expand Down Expand Up @@ -388,6 +389,7 @@ class ::TestName < ActiveRecord::Base
standard_dump.should =~ /t\.virtual "full_name",(\s*):limit => 512,(\s*):as => "\\"FIRST_NAME\\"\|\|', '\|\|\\"LAST_NAME\\"",(\s*):type => :string/
standard_dump.should =~ /t\.virtual "short_name",(\s*):limit => 300,(\s*):as =>(.*),(\s*):type => :string/
standard_dump.should =~ /t\.virtual "full_name_length",(\s*):precision => 38,(\s*):scale => 0,(\s*):as =>(.*),(\s*):type => :integer/
standard_dump.should =~ /t\.virtual "name_ratio",(\s*):as =>(.*)\"$/ # no :type
standard_dump.should =~ /t\.virtual "abbrev_name",(\s*):limit => 100,(\s*):as =>(.*),(\s*):type => :string/
standard_dump.should =~ /t\.virtual "field_with_leading_space",(\s*):limit => 300,(\s*):as => "' '\|\|\\"FIRST_NAME\\"\|\|' '",(\s*):type => :string/
end
Expand Down

0 comments on commit e897d63

Please sign in to comment.