CREATE DATABASE  IF NOT EXISTS `security` /*!40100 DEFAULT CHARACTER SET utf8 */ /*!80016 DEFAULT ENCRYPTION='N' */;
USE `security`;
--
-- 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`
--

CREATE TABLE `users` (
  `iduser` int NOT NULL AUTO_INCREMENT,
  `name` varchar(45) DEFAULT NULL,
  `password` varchar(250) DEFAULT NULL,
  PRIMARY KEY (`iduser`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb3;

--
-- Dumping data for table `users`
--

INSERT INTO `users` VALUES (1,'Anonymous','Anonymous');

--
-- 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 DEFAULT CHARSET=utf8mb3;

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



