brunojk / laravel-rethinkdb

MIT License
3 stars 1 forks source link

php artisan migrate throw exception #1

Open Extarys opened 7 years ago

Extarys commented 7 years ago

Hey!

Trying Laravel for the first time (and installed rethinkDB yesterday, it's amazing!) php artisan make:rethink-migration users --create=users

Also, calling php artisan migrate throw the following error:

$ php artisan migrate
  [Symfony\Component\Debug\Exception\FatalThrowableError]         
  Call to a member function supportsSchemaTransactions() on null

The file:

<?php

use Illuminate\Support\Facades\Schema;
use brunojk\LaravelRethinkdb\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
          //$table->increments('hero_id');
          $table->string('name');
          //$table->timestamps();
        });
    }

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

What should I do? :(

EDIT Reran with -vvv, output below

 () at /media/Web/RemoteVLUS/www/GameMaster/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:357
 Illuminate\Database\Migrations\Migrator->runMigration() at /media/Web/RemoteVLUS/www/GameMaster/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:177
 Illuminate\Database\Migrations\Migrator->runUp() at /media/Web/RemoteVLUS/www/GameMaster/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:146
 Illuminate\Database\Migrations\Migrator->runPending() at /media/Web/RemoteVLUS/www/GameMaster/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:95
 Illuminate\Database\Migrations\Migrator->run() at /media/Web/RemoteVLUS/www/GameMaster/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php:69
 Illuminate\Database\Console\Migrations\MigrateCommand->fire() at n/a:n/a
 call_user_func_array() at /media/Web/RemoteVLUS/www/GameMaster/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:29
 Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() at /media/Web/RemoteVLUS/www/GameMaster/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:87
 Illuminate\Container\BoundMethod::callBoundMethod() at /media/Web/RemoteVLUS/www/GameMaster/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:31
 Illuminate\Container\BoundMethod::call() at /media/Web/RemoteVLUS/www/GameMaster/vendor/laravel/framework/src/Illuminate/Container/Container.php:539
 Illuminate\Container\Container->call() at /media/Web/RemoteVLUS/www/GameMaster/vendor/laravel/framework/src/Illuminate/Console/Command.php:182
 Illuminate\Console\Command->execute() at /media/Web/RemoteVLUS/www/GameMaster/vendor/symfony/console/Command/Command.php:264
 Symfony\Component\Console\Command\Command->run() at /media/Web/RemoteVLUS/www/GameMaster/vendor/laravel/framework/src/Illuminate/Console/Command.php:167
 Illuminate\Console\Command->run() at /media/Web/RemoteVLUS/www/GameMaster/vendor/symfony/console/Application.php:869
 Symfony\Component\Console\Application->doRunCommand() at /media/Web/RemoteVLUS/www/GameMaster/vendor/symfony/console/Application.php:223
 Symfony\Component\Console\Application->doRun() at /media/Web/RemoteVLUS/www/GameMaster/vendor/symfony/console/Application.php:130
 Symfony\Component\Console\Application->run() at /media/Web/RemoteVLUS/www/GameMaster/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:122
 Illuminate\Foundation\Console\Kernel->handle() at /media/Web/RemoteVLUS/www/GameMaster/artisan:35
brunojk commented 7 years ago

@Extarys rethinkdb dont have increments ids, try use the index method instead. Like this:

public function up()
{
    Schema::create('users', function (Blueprint $table) {
        // if really is a primary key, change in rethinkdb config of that table 
        // (r.table('users').info() you see) or use the default 'id' field
        $table->index('hero_id'); 

        //that line is not necessary, the fields are dinamically created
        //on inserts and updates operations
        $table->string('name'); 

        // that line too, NoSQL dont need a structure like mysql
        // with the columns created previously
        $table->timestamps(); 
    });
}

Laravel Migrations I only used for index purpouses.

I had (and handle) many errors like this and anothers, the Rethink documentation is very good and help a lot. I copied from the Laravel for MongoDB link some codes to resolve some errors.

I really liked RethinkDB, mostly the realtime feature (is amazing), but for continue safety with that DB, check this link.

Extarys commented 7 years ago

Thanks! Yes I do know they "shut down", thanks for the info (you never know) The Linux foundation took over the project. They are suppose to release a new version soon (2.4 I think) May I ask what are you using now? :)

brunojk commented 7 years ago

I did not know about The Linux Foundation, thanks! Is a DB I really like. I really hope it works and they succeed.

I have using RethinkDB yet, in a realtime app, but with nodejs, koajs, rethinkdbdash and socket.io, is very powerfull the changesfeed and I have a proxy (nginx) to get the websockets connection from that server in nodejs.

Extarys commented 7 years ago

Cool! I installed koa a moment ago, may I ask if you use a controller/model middleware and which one if so? The one I found logged that it will be discontinued in the next koa verison :(

I found Koa-socket-2, build over socketio, I will give it a try. koa-router, koa-views with twig and rethinkdbdash.

brunojk commented 7 years ago

Sorry, but the app is very simple and I did not have to use anything like that.

Extarys commented 7 years ago

Dont worry.

Was nice talking to you :P :D