neo4j migration in laravel doesnot work properly

346 Views Asked by At

I am using Neo4j in my application with /Vinelab/NeoEloquent. Now the problem is that when I run php artisan neo4j:migrate --database=neo4j , node for the migration table is created.

Not any labels defined in function up() is not created. What should I do to solve this?

Schema class is,

<?php
use Vinelab\NeoEloquent\Schema\Blueprint;
use Vinelab\NeoEloquent\Migrations\Migration;
class CreateTestpostsTable extends Migration {
/**
 * Run the migrations.
 *
 * @return void
 */
public function up()
{
    Neo4jSchema::label('Testposts', function(Blueprint $label)
    {
          $label->unique('tpid');
          $label->index('name');
          $label->index('content');
    });
}
/**
 * Reverse the migrations.
 *
 * @return void
 */
public function down()
{
    Neo4jSchema::drop('Testposts');   
}

}
1

There are 1 best solutions below

1
On

According to your Schema code, no labels should be expected to be created. You are setting a constraint on the tpid to be unique, and indexing the name and content of the nodes with Testposts label.

To check if your migration has taken effect:

On a side note, if the Label of the node in your model is Post or anything other than Testposts, then you should change Testposts to whatever is in your model for this to work properly.