Skip to content

Getting method signature mismatch issue while creating migration #81

@himanshu-bankoti

Description

@himanshu-bankoti

Package version

version: v5.0.7

The bug

I tried creating the migration as per the document but i got the error stating _ Declaration of PDPhilip\Elasticsearch\Schema\ManagesDefaultMigrations::uuidMorphs($name, $indexName = null): void must be compatible with Illuminate\Database\Schema\Blueprint::uuidMorphs($name, $indexName = null, $after = null)_ , i think this is due to the method signature incompatibility. would appreciate any help.

To Reproduce

just create a normal Laravel migration and try migrating it.

  • Laravel : v12
  • ES: v5.0

Expected behavior

It should migrate properly.


**Component Versions **

     "require": {
        "php": "^8.2",
        "laravel/framework": "^12.0",
        "laravel/tinker": "^2.10.1",
        "pdphilip/elasticsearch": "^5.0"
    },

Additional context:

<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $index) {
            $index->keyword('country_code')->default('MY');
            $index->text('first_name')->copyTo('full_name');
            $index->text('last_name')->copyTo('full_name');
            $index->text('full_name');
            $index->text('email');
            $index->keyword('email');
            $index->integer('phone_number')->nullable();
            $index->boolean('status');
            $index->date('created_at');
            $index->date('updated_at');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down()
    {
        Schema::deleteIfExists('users');
    }
};
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions