Yii2 RBAC tables

Hi. I have a question about auth_assignment table structure.


create table `auth_assignment`

(

   `item_name`            varchar(64) not null,

   `user_id`              varchar(64) not null,

   `created_at`           integer,

   primary key (`item_name`, `user_id`),

   foreign key (`item_name`) references `auth_item` (`name`) on delete cascade on update cascade

) engine InnoDB;

Is it normal, that field user_id is varchar and not int? Why not int with normal index on this field?

Hi,

Never realized, but I think that is actually a good question… ?

Now I’m wondering also.

Only thing I can imagine:

To be compatible if someone uses something else than a integer value to store user IDs.

If there is any other reason I would like to know also.

Regards

Because anything could be used as web user ID including non-integers.