Skip to content

Commit 7873709

Browse files
committed
For tables that named with schema(ex. rails.users), they could not get length of column of varchar(40) gets length => nil.
1 parent 260e93b commit 7873709

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11

22
MASTER
33

4+
* For tables that named with schema(ex. rails.users), they could not get length of column.
5+
column of varchar(40) gets length => nil. Ticket #27 & #15 [Ken Tachiya]
6+
47
* Altered limited_update_conditions regex conditions, the .* would greedily fail
58
if the where_sql had WHERE in a table or field, etc. [Ransom Briggs]
69

lib/active_record/connection_adapters/sqlserver_adapter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1042,7 +1042,7 @@ def column_definitions(table_name)
10421042
columns.NUMERIC_PRECISION as numeric_precision,
10431043
CASE
10441044
WHEN columns.DATA_TYPE IN ('nchar','nvarchar') THEN columns.CHARACTER_MAXIMUM_LENGTH
1045-
ELSE COL_LENGTH(columns.TABLE_NAME, columns.COLUMN_NAME)
1045+
ELSE COL_LENGTH(columns.TABLE_SCHEMA+'.'+columns.TABLE_NAME, columns.COLUMN_NAME)
10461046
END as length,
10471047
CASE
10481048
WHEN columns.IS_NULLABLE = 'YES' THEN 1

0 commit comments

Comments
 (0)