Closed perlbrain closed 5 years ago
Just found this solution:
If your using laravel 5.8 the increments has changed to bigIncrements on ID columns, change it to increments and it will work.
Yeah, I'm still trying to decide how to deal with this annoying change in 5.8. More of a Brandenburg issue though.
any update on this issue? or any temp solution? even i try to change id on roles table to bigIncrements, still having some issues with role_permission` (errno: 150 "Foreign key constraint is incorrectly formed"
temp solution :
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateGatesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// 'admin', 'editor'
Schema::create('roles', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('slug');
$table->string('name')->nullable();
$table->timestamps();
});
Schema::create('role_permission', function (Blueprint $table) {
$table->bigInteger('role_id')->unsigned();
$table->string('permission_slug');
$table->timestamps();
$table->foreign('role_id')
->references('id')
->on('roles')
->onDelete('cascade');
$table->primary(['role_id', 'permission_slug']);
});
Schema::create('role_user', function (Blueprint $table) {
$table->bigInteger('role_id')->unsigned();
$table->bigInteger('user_id')->unsigned();
$table->timestamps();
$table->foreign('role_id')
->references('id')
->on('roles')
->onDelete('cascade');
$table->foreign('user_id')
->references('id')
->on('users')
->onDelete('cascade');
$table->primary(['role_id', 'user_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('role_permission');
Schema::dropIfExists('role_user');
Schema::dropIfExists('roles');
}
}
change integer to bigInteger and increments to bigIncrements at brandenburg/src/Database/Migrations/2017_05_28_115649_create_gates_table.php
Brandenburg has been updated to use the big int for Laravel 5.8, so this should now be resolved. Please re-open if you still experience an issue. Cheers.
hi,
I have installed nova and the table users included ofcourse. Then tried to install novatoolpermissions. First step not a problem composer require silvanite/novatoolpermissions Second step php artisan migrate, is a problem. The users table already exists. Then I renamed the current users table and tried again php artisan migrate. Excess violantion: 1071 specified Key too long.
How to resolve this.
regards,
Bryan