--
-- Host: 127.0.0.1    Database: security
-- ------------------------------------------------------


--
-- Table structure for table `roles`
--

CREATE TABLE `roles` (
  `idrole` int NOT NULL AUTO_INCREMENT,
  `name` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`idrole`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb3;

--
-- Dumping data for table `roles`
--

INSERT INTO `roles` VALUES (1,'admin'),(2,'user');

--
-- Table structure for table `users_roles`
--

CREATE TABLE `users_roles` (
  `idusers_roles` int NOT NULL AUTO_INCREMENT,
  `users_iduser` int NOT NULL,
  `roles_idrole` int NOT NULL,
  PRIMARY KEY (`idusers_roles`),
  KEY `fk_users_roles_users_idx` (`users_iduser`),
  KEY `fk_users_roles_roles1_idx` (`roles_idrole`),
  CONSTRAINT `fk_users_roles_roles1` FOREIGN KEY (`roles_idrole`) REFERENCES `roles` (`idrole`),
  CONSTRAINT `fk_users_roles_users` FOREIGN KEY (`users_iduser`) REFERENCES `users` (`iduser`)
) ENGINE=InnoDB AUTO_INCREMENT=42 DEFAULT CHARSET=utf8mb3;

--
-- Dumping data for table `users_roles`
--

INSERT INTO `users_roles` VALUES (40,41,1),(41,42,2);


