   `username` char(16) NOT NULL,
   `group` char(16) NOT NULL,
   PRIMARY KEY (`id`),
+  UNIQUE KEY `username_group` (`username`,`group`),
   KEY `user_group_fk2` (`group`),
-  KEY `user_group_fk1` (`username`),
-  CONSTRAINT `user_group_fk1` FOREIGN KEY (`username`) REFERENCES `user` (`username`) ON DELETE CASCADE ON UPDATE CASCADE,
-  CONSTRAINT `user_group_fk2` FOREIGN KEY (`group`) REFERENCES `group` (`group`) ON DELETE CASCADE ON UPDATE CASCADE
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
--- Dumping data for table centini.user_group: ~0 rows (approximately)
+  CONSTRAINT `user_group_fk1` FOREIGN KEY (`username`) REFERENCES `users` (`username`) ON DELETE CASCADE ON UPDATE CASCADE,
+  CONSTRAINT `user_group_fk2` FOREIGN KEY (`group`) REFERENCES `groups` (`group`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
+
+-- Dumping data for table centini.user_group: ~4 rows (approximately)
 /*!40000 ALTER TABLE `user_group` DISABLE KEYS */;
+INSERT INTO `user_group` (`id`, `username`, `group`) VALUES
+	(1, 'agent1', 'group1'),
+	(4, 'agent2', 'group3'),
+	(2, 'spv1', 'group1'),
+	(3, 'spv1', 'group2');
 /*!40000 ALTER TABLE `user_group` ENABLE KEYS */;
 
 

-- Host:                         192.168.1.8
-- Server version:               5.5.38-0ubuntu0.14.04.1 - (Ubuntu)
-- Server OS:                    debian-linux-gnu
-- HeidiSQL Version:             8.3.0.4694
-- --------------------------------------------------------

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;

  `finish` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `user_session_log_fk1` (`username`),
  CONSTRAINT `user_session_log_fk1` FOREIGN KEY (`username`) REFERENCES `users` (`username`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=82 DEFAULT CHARSET=utf8;

-- Dumping data for table centini.user_session_log: ~81 rows (approximately)
/*!40000 ALTER TABLE `user_session_log` DISABLE KEYS */;
INSERT INTO `user_session_log` (`id`, `username`, `start`, `finish`) VALUES
	(1, 'agent1', '2014-10-14 12:52:21', NULL),
