0
votes

I am trying to migrate my postgresql table, but when launch the command php artisan migrate it return the follow error:

SQLSTATE[08P01]: <>: 7 ERROR: bind message supplies 1 parameters, but prepared statement "pdo_stmt_00000003" requires 2 (SQL: select * from information_schema.tables where table_schema = migrations and table_name = ?)

One of my migration:

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');
}

}

And my database configuration:

'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',
    ]
],

My .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

I tried to track it down and seems that it doesn't use the correct grammar for the function repositoryExists, it uses the default grammar witch doesn't send the schema parameter.

The other query executed via model or repository works fine, I get this error only for the migration command.

Any suggestion to solve this problem?

1
post your migration code too - Romantic Dev
Have you checked your DB Driver in config file / dotenv file ? Like DB_CONNECTION=postgresql - iizno
I edit my post with my configuration - Rey777
What version of php are you running? - Option
I am using PHP 7.1.11 on Ubuntu 17.10 - Rey777

1 Answers

0
votes

I figure out the problem. I migrated the project from laravel 5.3 to 5.5 and the old project used the module Aejnsn\Postgresify.

It causes my problem on migration.

Remove it and all works again.