Skip to content

Commit d6b771e

Browse files
Fix compileColumnListing for tables with schema (#34076)
The compileColumnListing method did not work for tables in a non-default schema. It also listed too many columns for tables that appear in more than one schema. Using SQL Server's object_id-function, in stead of obj.name, fixes this issue.
1 parent c6cf381 commit d6b771e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function compileColumnListing($table)
4848
{
4949
return "select col.name from sys.columns as col
5050
join sys.objects as obj on col.object_id = obj.object_id
51-
where obj.type = 'U' and obj.name = '$table'";
51+
where obj.type = 'U' and obj.object_id = object_id('$table')";
5252
}
5353

5454
/**

0 commit comments

Comments
 (0)