Laravel 5.5迁移错误

时间:2018-02-23 10:43:01

标签: php laravel migration

我正在尝试迁移我的postgresql表,但是当启动命令php artisan migrate时,它会返回以下错误:

  

SQLSTATE [08P01]:<>:7错误:绑定消息提供1个参数,但是准备好的语句“pdo_stmt_00000003”需要2个(SQL:select * from information_schema.tables      table_schema = migrations和table_name =?)

我的一次迁移:

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateSchedulesTable extends Migration {

/**
 * Run the migrations.
 *
 * @return void
 */
public function up()
{
    Schema::create('schedules', function(Blueprint $table)
    {
        $table->increments('id');
        $table->string('schedule_name')->unique();
        $table->integer('parent_id')->unsigned()->nullable();
        $table->integer('launch_sequence_id')->unsigned();
        $table->string('day_of_week', 10)->nullable();
        $table->string('command_type', 50);
        $table->integer('hours')->unsigned()->nullable();
        $table->integer('minutes')->unsigned()->nullable();
        $table->integer('dd')->unsigned()->nullable();
        $table->integer('mm')->unsigned()->nullable();
        $table->integer('yyyy')->unsigned()->nullable();
        $table->boolean('enabled')->default(1);
        $table->boolean('ascending')->default(0);
        $table->dateTime('last_execution')->nullable();
        $table->dateTime('last_success')->nullable();
        $table->integer('retry')->default(0);

        $table->timestamps();
        $table->softDeletes();
    });

    DB::statement('ALTER TABLE schedules ADD CONSTRAINT day_of_week_check CHECK ((day_of_week)::text = ANY (ARRAY[(\'all\'::character varying)::text, (\'monday\'::character varying)::text, (\'tuesday\'::character varying)::text, (\'wednesday\'::character varying)::text, (\'thursday\'::character varying)::text, (\'friday\'::character varying)::text, (\'saturday\'::character varying)::text, (\'sunday\'::character varying)::text]))');
}


/**
 * Reverse the migrations.
 *
 * @return void
 */
public function down()
{
    Schema::drop('schedules');
}

}

我的数据库配置:

'default' => env('DB_CONNECTION', 'pgsql'),
'connections' => [

    'pgsql' => [
        'driver' => 'pgsql',
        'host' => env('DB_HOST', '127.0.0.1'),
        'port' => env('DB_PORT', '5432'),
        'database' => env('DB_DATABASE', 'forge'),
        'username' => env('DB_USERNAME', 'forge'),
        'password' => env('DB_PASSWORD', ''),
        'charset' => 'utf8',
        'prefix' => '',
        'schema' =>  env('DB_SCHEMA', 'public'),
        //'sslmode' => 'prefer',
    ]
],

我的.env

DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=livion
DB_USERNAME=livion
DB_PASSWORD=secret
DB_SCHEMA=public

我试图跟踪它,似乎它没有使用函数repositoryExists的正确语法,它使用默认语法,不发送架构参数。

通过模型或存储库执行的其他查询工作正常,我只为迁移命令收到此错误。

有任何解决这个问题的建议吗?

1 个答案:

答案 0 :(得分:0)

我找出问题所在。 我将项目从laravel 5.3迁移到5.5,旧项目使用模块Aejnsn \ Postgresify。

这会导致我的迁移问题。

删除它,一切都有效。