我正在尝试执行工匠迁移。我已经安装了 odbc-driver 并且连接设置成功,因为我可以从 db 读取。问题是我无法使用 php artisan migrate 创建表。我在 php.ini 启用了 odbc。错误如下:
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Class 'Ccovey\\ODBCDriver\\Schema\\Grammars\\Sq
lServerGrammar' not found","file":"C:\\wamp\\www\\license3\\vendor\\ccovey\\odbc-driver-l4\\src\\Ccovey\\ODBCDriver\\ODBCDriverConnecti
on.php","line":36}}
这是我的 ODBCDriverConnection 类:
class ODBCDriverConnection extends Connection
{
/**
* @return Query\Grammars\Grammar
*/
protected function getDefaultQueryGrammar()
{
$grammarConfig = $this->getGrammarConfig();
if ($grammarConfig) {
$packageGrammar = "Ccovey\\ODBCDriver\\Grammars\\" . $grammarConfig;
if (class_exists($packageGrammar)) {
return $this->withTablePrefix(new $packageGrammar);
}
$illuminateGrammar = "Illuminate\\Database\\Query\\Grammars\\" . $grammarConfig;
if (class_exists($illuminateGrammar)) {
return $this->withTablePrefix(new $illuminateGrammar);
}
}
return $this->withTablePrefix(new Grammar);
}
/**
* Default grammar for specified Schema
* @return Schema\Grammars\Grammar
*/
protected function getDefaultSchemaGrammar()
{
return $this->withTablePrefix(new Schema\Grammars\SqlServerGrammar);
}
protected function getGrammarConfig()
{
if ($this->getConfig('grammar')) {
return $this->getConfig('grammar');
}
return false;
}
}