I'm using this library shso/laravel-cassandra to access my cassandra instance from Lumen and everything is working fine. but when I try to use Laravel migrate I get this exception
[Symfony\Component\Debug\Exception\FatalThrowableError]
Call to a member function prepare() on null
Exception trace:
() at /home/masoud/Codes/TheSite/api/vendor/illuminate/database/Connection.php:326
Illuminate\Database\Connection->Illuminate\Database\{closure}() at /home/masoud/Codes/TheSite/api/vendor/illuminate/database/Connection.php:657
Illuminate\Database\Connection->runQueryCallback() at /home/masoud/Codes/TheSite/api/vendor/illuminate/database/Connection.php:624
Illuminate\Database\Connection->run() at /home/masoud/Codes/TheSite/api/vendor/illuminate/database/Connection.php:333
Illuminate\Database\Connection->select() at /home/masoud/Codes/TheSite/api/vendor/illuminate/database/Connection.php:304
Illuminate\Database\Connection->selectFromWriteConnection() at /home/masoud/Codes/TheSite/api/vendor/illuminate/database/Schema/Builder.php:75
Illuminate\Database\Schema\Builder->hasTable() at /home/masoud/Codes/TheSite/api/vendor/illuminate/database/Migrations/DatabaseMigrationRepository.php:169
Illuminate\Database\Migrations\DatabaseMigrationRepository->repositoryExists() at /home/masoud/Codes/TheSite/api/vendor/illuminate/database/Migrations/Migrator.php:583
Illuminate\Database\Migrations\Migrator->repositoryExists() at /home/masoud/Codes/TheSite/api/vendor/illuminate/database/Console/Migrations/MigrateCommand.php:91
Illuminate\Database\Console\Migrations\MigrateCommand->prepareDatabase() at /home/masoud/Codes/TheSite/api/vendor/illuminate/database/Console/Migrations/MigrateCommand.php:63
Illuminate\Database\Console\Migrations\MigrateCommand->handle() at n/a:n/a
call_user_func_array() at /home/masoud/Codes/TheSite/api/vendor/illuminate/container/BoundMethod.php:32
Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() at /home/masoud/Codes/TheSite/api/vendor/illuminate/container/BoundMethod.php:90
Illuminate\Container\BoundMethod::callBoundMethod() at /home/masoud/Codes/TheSite/api/vendor/illuminate/container/BoundMethod.php:34
Illuminate\Container\BoundMethod::call() at /home/masoud/Codes/TheSite/api/vendor/illuminate/container/Container.php:576
Illuminate\Container\Container->call() at /home/masoud/Codes/TheSite/api/vendor/illuminate/console/Command.php:183
Illuminate\Console\Command->execute() at /home/masoud/Codes/TheSite/api/vendor/symfony/console/Command/Command.php:255
Symfony\Component\Console\Command\Command->run() at /home/masoud/Codes/TheSite/api/vendor/illuminate/console/Command.php:170
Illuminate\Console\Command->run() at /home/masoud/Codes/TheSite/api/vendor/symfony/console/Application.php:921
Symfony\Component\Console\Application->doRunCommand() at /home/masoud/Codes/TheSite/api/vendor/symfony/console/Application.php:273
Symfony\Component\Console\Application->doRun() at /home/masoud/Codes/TheSite/api/vendor/symfony/console/Application.php:149
Symfony\Component\Console\Application->run() at /home/masoud/Codes/TheSite/api/vendor/illuminate/console/Application.php:90
Illuminate\Console\Application->run() at /home/masoud/Codes/TheSite/api/vendor/laravel/lumen-framework/src/Console/Kernel.php:115
Laravel\Lumen\Console\Kernel->handle() at /home/masoud/Codes/TheSite/api/artisan:35
This is the PHP code I wrote:
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use ShSo\Lacassa\Schema\Grammar;
class CreateUsersByEmail extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
DB::connection()->setSchemaGrammar(new ShSo\Lacassa\Schema\Grammar());
$schema = DB::connection()->getSchemaBuilder();
$schema->blueprintResolver(function($table, $callback) {
return new \ShSo\Lacassa\Schema\Blueprint($table, $callback);
});
$schema->create('users_by_email', function ($table) {
$table->uuid('id'); //User ID
$table->varchar("email");
$table->varchar("first_name");
$table->varchar("last_name");
$table->timestamp("email_verified_at");
$table->varchar("password");
$table->varchar("token");
$table->timestamp("created_at");
$table->timestamp("updated_at");
$table->primary("email");
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users_by_email');
}
}
I couldn't find any thing on google and I haven't been able to figure out what I'm doing wrong. any help is appreciated.
from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2EOoAiJ
via IFTTT
Aucun commentaire:
Enregistrer un commentaire