The current code is:
public function compileColumnExists($table)
{
return "select column_name from information_schema.columns where table_name = '$table'";
}
The issue is that this function does not take into account the connection's schema so Schema::hasColumn($table, $column) can return incorrect results.
A quick explanation:
Tables:
schema_1.table_name: column_1, column_2
schema_2.table_name: column_1
Connections:
connection_1 -> schema_1
connection_2 -> schema_2
The following call will return an incorrect result:
$hasColumn = Schema::connection('connection_2')->hasColumn('table_name','column_2');
$hasColumn will have an incorrect value of true because compileColumnExists() only checks against the table name when it should check against the table name AND the current connection's schema.