Vinelab / NeoEloquent

The Neo4j OGM for Laravel
MIT License
633 stars 197 forks source link

Neo4J:Migrate:Rollback not working at all #291

Closed axelthat closed 3 years ago

axelthat commented 6 years ago

When I try to run php artisan neo4j:migrate:rollback or php artisan neo4j:migrate:refresh, it gives me the following error:

Vinelab\NeoEloquent\QueryException  : ParameterNotFoundException: Expected parameter(s): migration, migration

  at C:\wamp64\www\blog\vendor\vinelab\neoeloquent\src\Connection.php:467
    463|             // message to include the bindings with Cypher, which will make this exception a
    464|             // lot more helpful to the developer instead of just the database's errors.
    465|         catch (Exception $e)
    466|         {
  > 467|             throw new QueryException($query, $bindings, $e);
    468|         }
    469|
    470|         // Once we have run the query we will calculate the time that it took to run and
    471|         // then log the query, bindings, and execution time so we will report them on

  Exception trace:

  1   Vinelab\NeoEloquent\Connection::run("MATCH (neoEloquentMigration:`NeoEloquentMigration`) WHERE neoEloquentMigration.migration = {migration} OPTIONAL MATCH (neoEloquentMigration:`NeoEloquentMigration`)-[r]-()  WHERE neoEloquentMigration.migration = {migration} DELETE  neoEloquentMigration,r", Object(Closure))
      C:\wamp64\www\blog\vendor\vinelab\neoeloquent\src\Connection.php:222

  2   Vinelab\NeoEloquent\Connection::affectingStatement("MATCH (neoEloquentMigration:`NeoEloquentMigration`) WHERE neoEloquentMigration.migration = {migration} OPTIONAL MATCH (neoEloquentMigration:`NeoEloquentMigration`)-[r]-()  WHERE neoEloquentMigration.migration = {migration} DELETE  neoEloquentMigration,r")
      C:\wamp64\www\blog\vendor\laravel\framework\src\Illuminate\Database\Connection.php:435

  Please use the argument -v to see more details.

How can I fix this?

Mulkave commented 6 years ago

Please add the version of NE that you are using (preferably from your composer.lock file). And more details about the migration code that you attempt to rollback (all a similar fictitious example if you'd rather preserve confidentiality).

axelthat commented 6 years ago

Hi @Mulkave ! I am using v1.4.6 !

axelthat commented 6 years ago

Here's the migration code which I attempted to rollback:

<?php

use Vinelab\NeoEloquent\Schema\Blueprint;
use Vinelab\NeoEloquent\Migrations\Migration;

class CreateUsersMainLabel extends Migration {

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Neo4jSchema::label('users_main', function(Blueprint $label)
        {
            $label->index('fname');
            $label->index('lname');
            $label->unique('email');
            $label->index('password');
            $label->index('old_password');
            $label->index('joined');
            $label->index('dob_year');
            $label->index('dob_month');
            $label->index('dob_day');
            $label->index('gender');
            $label->index('country');
            $label->index('active_status');
            $label->index('last_active_status');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Neo4jSchema::dropIfExists('users_main');
    }

} 
holix commented 5 years ago

Hey SanjayBanjade,

you should upgrade to version v1.4.7. This was fixed in this release.

axelthat commented 5 years ago

@holix Thanks a lot man!

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.