Skip to content

Commit

Permalink
Default value detection in column_definitions is kinder to badly form…
Browse files Browse the repository at this point in the history
…atted, or long winded user defined functions, for default values. Resolves ticket rails-sqlserver#8
  • Loading branch information
metaskills committed Aug 12, 2009
1 parent f994f7d commit 28ebca7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG
@@ -1,6 +1,9 @@

MASTER

* Default value detection in column_definitions is kinder to badly formatted, or long winded user
defined functions, for default values. Resolves ticket #8 [Ken Collins]

* Make sure bigint SQL Server data type can be used and converted back to Bignum as expected. [Ken Collins]


Expand Down
3 changes: 2 additions & 1 deletion lib/active_record/connection_adapters/sqlserver_adapter.rb
Expand Up @@ -1081,7 +1081,8 @@ def column_definitions(table_name)
when nil, '(null)', '(NULL)'
nil
else
ci[:default_value].match(/\A\(+N?'?(.*?)'?\)+\Z/)[1]
match_data = ci[:default_value].match(/\A\(+N?'?(.*?)'?\)+\Z/)
match_data ? match_data[1] : nil
end
ci[:null] = ci[:is_nullable].to_i == 1 ; ci.delete(:is_nullable)
ci
Expand Down

0 comments on commit 28ebca7

Please sign in to comment.