【发布时间】:2018-12-05 18:20:14
【问题描述】:
我正在尝试运行php artisan migrate 命令,但没有得到它。我收到此错误
SQLSTATE[42601]: 语法错误: 7 错误: """" 处或附近的零长度分隔标识符\n 第 1 行:将 search_path 设置为 ""\n ^ (SQL: select count(*) as aggregate from "categoria" where "deleted_at" is null and "categoria"."deleted_at" is null)。
我的班级迁移类别:
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCategoriasTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('categoria', function (Blueprint $table) {
$table->increments('id');
$table->string('nome', 60);
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('categoria');
}
}
这个地方发生在我运行 php artisan migrate 命令时。在vagrant中,出现这个错误
vagrant@homestead:~/code/controle-interno$ php artisan migrate
**************************************
* Application In Production! *
**************************************
Do you really wish to run this command? (yes/no) [no]:
> yes
In Connection.php line 664:
SQLSTATE[42601]: Syntax error: 7 ERROR: zero-length delimited identifier at or near """"
LINE 1: set search_path to ""
^ (SQL: select * from information_schema.tables where table_schema = public and table_name = migrations)
In PDOStatement.php line 143:
SQLSTATE[42601]: Syntax error: 7 ERROR: zero-length delimited identifier at or near """"
LINE 1: set search_path to ""
^
In PDOStatement.php line 141:
SQLSTATE[42601]: Syntax error: 7 ERROR: zero-length delimited identifier at or near """"
LINE 1: set search_path to ""
^
我的设置是 Laravel 最新的宅基地
- Laravel 5.5
- Postgres 10.4
如果有任何帮助,我将不胜感激!
【问题讨论】:
-
请发布代码,而不仅仅是一个错误。寻求调试帮助的问题(“为什么这段代码不起作用?”)必须包括所需的行为、特定问题或错误和必要的最短代码 在问题本身中重现它。没有明确的问题陈述的问题对其他读者没有用处。见:How to create a Minimal, Complete, and Verifiable example.
-
你使用的是什么版本的 Laravel?
-
您确定您的数据库配置正确吗? (尤其是 Postgres 架构?)
-
@RossWilson 我改进了对问题的描述。
-
@MattGibson 是的,我愿意。我正在使用 dbeaver 并检查了架构是否已创建。
标签: php laravel postgresql vagrant artisan-migrate