Roles

Allows to manage access based on roles and permissions (tree or flat model). For RianLab.User or Lovata.Buddies

Back to Roles Support

okoaproject200728613
okoaproject200728613

The installation of this plugin fails with the following exception: "SQLSTATE[HY000]: General error: 1 Cannot add a NOT NULL column with default value NULL (SQL: alter table "users" add column "role_id" integer not null)" on line 664 of C:\xampp\htdocs\techmix\vendor\laravel\framework\src\Illuminate\Database\Connection.php

Don't know if is happening to someone else.

vdomah
vdomah

Hi There is no instruction in migration to set role_id default value to null. May be there are some general db settings that cause this

mugunth
mugunth

Hi Vdomah, I also got this error while installing your Roles plugin.

I made the following change (assuming role_id field can be a nullable field):
Changed the following line in the file:
update/users_add_role_id_column.php
from:
$table->integer('role_id');
to:
$table->integer('role_id')->nullable();

After making the changes, used the octobercms backend to install the plugin, the problem got resolved.

vdomah
vdomah

mugunth said:

Hi Vdomah, I also got this error while installing your Roles plugin.

I made the following change (assuming role_id field can be a nullable field):
Changed the following line in the file:
update/users_add_role_id_column.php
from:
$table->integer('role_id');
to:
$table->integer('role_id')->nullable();

After making the changes, used the octobercms backend to install the plugin, the problem got resolved.

Hello! You seems to be fixing the old plugin version. Because, firstly role_id column is renamed to vdomah_role_id according to new OctoberCMS plugin guidelines (from v1.3.0).

Secondly, the vdomah_role_id column was made nullable in v1.3.8 (Oct 09, 2020).

1-4 of 4