CREATE TABLE IF NOT EXISTS `groups` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(32) NOT NULL, `admin_user_id` int(10) unsigned NOT NULL, `is_deleted` tinyint(1) NOT NULL DEFAULT '0', `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, PRIMARY KEY (`id`), KEY `groups_admin_user_id_foreign` (`admin_user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; CREATE TABLE IF NOT EXISTS `users` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `username` varchar(32) NOT NULL, `email` varchar(64) NOT NULL, `password` varchar(32) NOT NULL, `is_deleted` tinyint(1) NOT NULL DEFAULT '0', `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; CREATE TABLE IF NOT EXISTS `group_user` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `users_id` int(10) unsigned NOT NULL, `groups_id` int(10) unsigned NOT NULL, `is_deleted` tinyint(1) NOT NULL DEFAULT '0', `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, PRIMARY KEY (`id`), KEY `group_user_users_id_foreign` (`users_id`), KEY `group_user_groups_id_foreign` (`groups_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; ALTER TABLE `groups` ADD CONSTRAINT `groups_admin_user_id_foreign` FOREIGN KEY (`admin_user_id`) REFERENCES `users` (`id`); ALTER TABLE `group_user` ADD CONSTRAINT `group_user_groups_id_foreign` FOREIGN KEY (`groups_id`) REFERENCES `groups` (`id`), ADD CONSTRAINT `group_user_users_id_foreign` FOREIGN KEY (`users_id`) REFERENCES `users` (`id`);
For some reason the code on the group management side:
$crud->set_relation_n_n('users','group_user','users','groups_id','users_id','username');
does not seem to produce any output.
Any suggestions?