-
Notifications
You must be signed in to change notification settings - Fork 26
Description
Package version
v2.9.7
Laravel v9.52.16
Elasticssearch 8.12.2
Describe the bug
First, thanks so much for this great package. Your dedication for implementing the whole Eloquent feature set is really impressive.
As I understand it, the migration feature of this package should be usable like Eloquent's migrations, right? So, creating schema and then migrating with artisan migrate.
(Edit) Elasticsearch is the only data source for my project. I saw that in your laravel-elasticsearch-tests repository, all migrations get called by client code, not by the laravel framework like it's the case with artisan migrate. If the migration feature of this package is not intended to be used like this, please excuse me. (End of Edit)
After running artisan migrate, Laravel throws the following error:
Call to undefined method PDPhilip\Elasticsearch\Schema\Builder::hasTable()
at vendor/laravel/framework/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php:169
165▕ public function repositoryExists()
166▕ {
167▕ $schema = $this->getConnection()->getSchemaBuilder();
168▕
➜ 169▕ return $schema->hasTable($this->table);
170▕ }
171▕
172▕ /**
173▕ * Delete the migration repository data store.
+21 vendor frames
22 artisan:35
Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
To Reproduce
Steps to reproduce the behavior:
- Create a migration as specified in the README
<?php
use Illuminate\Database\Migrations\Migration;
use PDPhilip\Elasticsearch\Schema\IndexBlueprint;
use PDPhilip\Elasticsearch\Schema\Schema;
class CreatAuditIndex extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
{
Schema::create('audits', function (IndexBlueprint $index) {
$index->keyword('domain');
$index->keyword('id');
$index->date('updated_at');
$index->keyword('updated_by');
$index->nested('updated_fields');
});
}
public function down(): void
{
Schema::deleteIfExists('audits');
}
};- run the migration with
artisan migrate
Expected behavior
As I understand it, an index should be created.
Component Versions (Paste in the require section from your composer.json file):
"require": {
"php": "^8.1",
"ext-json": "*",
"laravel/framework": "^9.0",
"laravel/tinker": "2.7",
"pdphilip/elasticsearch": "~2.9"
},Additional context:
I'm not sure, but I think Laravel expends your custom Schema or Schema Builder to have the same methods as Illuminate\Database\Schema\Builder, e.g hasTable() or dropAllTables()
When running artisan migrate:fresh for example, instead of hasTable() the method dropAllTables() is not found.