Php RejectionDB-无法在Laravel 5.5中迁移
我正试图创建一个RejectionDB+Laravel的演示,然后我就被困在了迁移过程中。当我尝试使用php artisan migrate进行迁移时,我遇到了这个错误Php RejectionDB-无法在Laravel 5.5中迁移,php,laravel,rethinkdb,laravel-5.5,laravel-migrations,Php,Laravel,Rethinkdb,Laravel 5.5,Laravel Migrations,我正试图创建一个RejectionDB+Laravel的演示,然后我就被困在了迁移过程中。当我尝试使用php artisan migrate进行迁移时,我遇到了这个错误 [Symfony\Component\Debug\Exception\FatalThrowableError] Type
[Symfony\Component\Debug\Exception\FatalThrowableError]
Type error: Argument 1 passed to Users::{closure}() must be an instance of duxet\Rethinkdb\Schema\Blueprint, instance of Illuminate\Database\Sc
hema\Blueprint given, called in /opt/lampp/htdocs/xyzz-laravel/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php on line 164
我在回购协议中研究了这个问题,但在bug中列出了它,没有得到正确的解决。有没有人遇到过这个问题,并且知道如何修复这个bug
这是我的迁移
<?php
use Illuminate\Support\Facades\Schema;
use duxet\Rethinkdb\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class Users extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users',function (Blueprint $table){
$table->increments('id');
$table->string('name');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('users');
}
}
通过此命令修复此问题
php artisan migrate --database=rethinkdb
由于我在我的database.php
文件中有DB\u CONNECTION='referencedb
,所以当您通过此错误时,您也会发现其他问题,为此,我已分叉并请求拉取请求。在那之前你可以自己修好
发行#1和回购
为此,您需要在迁移时指定数据库名称,如果默认情况下有多个数据库,则会选择illumb\database\Schema\Blueprint
,如下所示
php artisan migrate --database=rethinkdb
然后您将在这里声明的Blueprint.php
中得到另一个错误
[错误例外]
duxet\db\Schema\Blueprint::index($column)的声明,
$options=NULL)应与兼容
照亮\Database\Schema\Blueprint::index($columns,$name)=
NULL,$algorithm=NULL)
您可以在Blueprint.php中通过替换
public function index($column, $options = null)
借
第2期和
[Symfony\Component\Debug\Exception\FatalErrorException]
对duxet\DB\Query\Builder的访问级别::$operators必须为
public(与class\Database\Query\Builder中相同)
要解决此问题,您必须在Builder.php
将$operator
访问类型从protected
更改为public
public $operators = [
'=', '<', '>', '<=', '>=', '<>', '!=',
'like', 'not like', 'between', 'ilike',
'&', '|', '^', '<<', '>>',
'rlike', 'regexp', 'not regexp',
'~', '~*', '!~', '!~*',
'contains', 'exists', 'type', 'mod', 'size',
];
借
第4期
现在,在解决所有这些问题之后,您将遇到另一个问题,我今天在解决所有这些问题时发现了这个问题
[Symfony\Component\Debug\Exception\fatalthrowayerror]
在null上调用成员函数supportsSchemaTransactions()
要解决此问题,您需要遵循以下步骤。
1.在src/Schema
命名空间中创建一个文件Grammar.php
,然后粘贴此代码
<?php
namespace duxet\RethinkDB\Schema;
use Illuminate\Database\Schema\Grammars\Grammar as BaseGrammar;
/**
* Class Grammar
*
* @package Moloquent\Schema
*/
class Grammar extends BaseGrammar {
}
然后在public function\uu构造(array$config)
中添加这个
$this->schemaGrammar = new Grammar();
以上所有的事情我都已经解决了,并且提出了一个拉动请求。希望这会对你有所帮助,你不必像我一样挠头:)
更新
11月13日,pull请求被接受,现在,如果发现任何问题,您无需执行以下步骤,您仍然可以尝试
public function groupBy(...$groups)
<?php
namespace duxet\RethinkDB\Schema;
use Illuminate\Database\Schema\Grammars\Grammar as BaseGrammar;
/**
* Class Grammar
*
* @package Moloquent\Schema
*/
class Grammar extends BaseGrammar {
}
use duxet\Rethinkdb\Schema\Grammar;
$this->schemaGrammar = new Grammar();