-
Notifications
You must be signed in to change notification settings - Fork 2
users2group table
Bhavesh Ramburn edited this page Mar 21, 2019
·
1 revision
The Users 2 Group table is a join table - M2M relationship between the Group and Users table. It also has a pivot of permission.
The structure is highlighted below
CREATE TABLE `user2group` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`groupid` int(11) unsigned NOT NULL,
`userid` int(11) unsigned NOT NULL,
`perm` varchar(128) DEFAULT NULL COMMENT 'admin: administrator; moderator: moderator; user:user',
PRIMARY KEY (`id`),
KEY `u2u` (`userid`),
KEY `g2g` (`groupid`),
CONSTRAINT `g2g` FOREIGN KEY (`groupid`) REFERENCES `group` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `u2u` FOREIGN KEY (`userid`) REFERENCES `users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
(c) 2019 Bhavesh Ramburn