aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-11-06 07:48:24 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-11-06 07:48:24 +0000
commit6c5572701aa74c90dc5ee3282f450c1a17207c36 (patch)
tree712fc2e370ca8c4930e58a673a32e3d10f16b30f /activerecord/lib/active_record
parentc7da7a38d7d331e66910cc46e5fec13268b75acd (diff)
downloadrails-6c5572701aa74c90dc5ee3282f450c1a17207c36.tar.gz
rails-6c5572701aa74c90dc5ee3282f450c1a17207c36.tar.bz2
rails-6c5572701aa74c90dc5ee3282f450c1a17207c36.zip
Fixed that SQL Server should ignore :size declarations on anything but integer and string in the agnostic schema representation (closes #2756) [Ryan Tomayko]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2887 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb
index fa9ec97794..a1b424f260 100644
--- a/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb
@@ -175,7 +175,7 @@ module ActiveRecord
:primary_key => "int NOT NULL IDENTITY(1, 1) PRIMARY KEY",
:string => { :name => "varchar", :limit => 255 },
:text => { :name => "text" },
- :integer => { :name => "int"},
+ :integer => { :name => "int" },
:float => { :name => "float", :limit => 8 },
:datetime => { :name => "datetime" },
:timestamp => { :name => "datetime" },
@@ -414,6 +414,15 @@ module ActiveRecord
execute "DROP INDEX #{table_name}.#{index_name(table_name, options)}"
end
+ def type_to_sql(type, limit = nil) #:nodoc:
+ native = native_database_types[type]
+ # if there's no :limit in the default type definition, assume that type doesn't support limits
+ limit = native[:limit] ? limit || native[:limit] : nil
+ column_type_sql = native[:name]
+ column_type_sql << "(#{limit})" if limit
+ column_type_sql
+ end
+
private
def select(sql, name = nil)
rows = []