diff --git a/src/main/resources/Inventario_bueno_v1.sql b/src/main/resources/Inventario_bueno_v1.sql new file mode 100644 index 0000000..f7517ac --- /dev/null +++ b/src/main/resources/Inventario_bueno_v1.sql @@ -0,0 +1,180 @@ +-- MySQL Workbench Forward Engineering + +SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; +SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; +SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'; + +-- ----------------------------------------------------- +-- Schema mydb +-- ----------------------------------------------------- +-- ----------------------------------------------------- +-- Schema inventario +-- ----------------------------------------------------- + +-- ----------------------------------------------------- +-- Schema inventario +-- ----------------------------------------------------- +CREATE SCHEMA IF NOT EXISTS `inventario` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci ; +USE `inventario` ; + +-- ----------------------------------------------------- +-- Table `inventario`.`users` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `inventario`.`users` ; + +CREATE TABLE IF NOT EXISTS `inventario`.`users` ( + `id` BIGINT NOT NULL AUTO_INCREMENT, + `password` VARCHAR(255) NOT NULL, + `role` ENUM('ADMIN', 'USER') CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_0900_ai_ci' NOT NULL, + `nombre` VARCHAR(255) NOT NULL, + `mail` VARCHAR(45) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE INDEX `UKr43af9ap4edm43mmtq01oddj6` (`nombre` ASC) VISIBLE, + UNIQUE INDEX `mail_UNIQUE` (`mail` ASC) VISIBLE) +ENGINE = InnoDB +AUTO_INCREMENT = 6 +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_0900_ai_ci; + + +-- ----------------------------------------------------- +-- Table `inventario`.`tipodato` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `inventario`.`tipodato` ; + +CREATE TABLE IF NOT EXISTS `inventario`.`tipodato` ( + `idtipodato` INT NOT NULL AUTO_INCREMENT, + `tipo_dato` VARCHAR(45) NULL, + PRIMARY KEY (`idtipodato`)) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `inventario`.`propiedad` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `inventario`.`propiedad` ; + +CREATE TABLE IF NOT EXISTS `inventario`.`propiedad` ( + `idpropiedad` INT NOT NULL AUTO_INCREMENT, + `nombre` VARCHAR(45) NULL, + `tipodato_idtipodato` INT NOT NULL, + PRIMARY KEY (`idpropiedad`), + UNIQUE INDEX `nombre_UNIQUE` (`nombre` ASC) VISIBLE, + INDEX `fk_propiedad_tipodato_idx` (`tipodato_idtipodato` ASC) VISIBLE, + CONSTRAINT `fk_propiedad_tipodato` + FOREIGN KEY (`tipodato_idtipodato`) + REFERENCES `inventario`.`tipodato` (`idtipodato`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `inventario`.`ubicacion` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `inventario`.`ubicacion` ; + +CREATE TABLE IF NOT EXISTS `inventario`.`ubicacion` ( + `idubicacion` INT NOT NULL AUTO_INCREMENT, + `nombre` VARCHAR(25) NULL, + `descripcion` VARCHAR(100) NULL, + `notas` VARCHAR(255) NULL, + PRIMARY KEY (`idubicacion`)) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `inventario`.`categoria` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `inventario`.`categoria` ; + +CREATE TABLE IF NOT EXISTS `inventario`.`categoria` ( + `idcategoria` INT NOT NULL AUTO_INCREMENT, + `nombre` VARCHAR(45) NULL, + PRIMARY KEY (`idcategoria`)) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `inventario`.`producto` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `inventario`.`producto` ; + +CREATE TABLE IF NOT EXISTS `inventario`.`producto` ( + `idproducto` INT NOT NULL AUTO_INCREMENT, + `nombre` VARCHAR(45) NULL, + `productocol` VARCHAR(45) NULL, + `categoria_idcategoria` INT NOT NULL, + PRIMARY KEY (`idproducto`), + INDEX `fk_producto_categoria1_idx` (`categoria_idcategoria` ASC) VISIBLE, + CONSTRAINT `fk_producto_categoria1` + FOREIGN KEY (`categoria_idcategoria`) + REFERENCES `inventario`.`categoria` (`idcategoria`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `inventario`.`item` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `inventario`.`item` ; + +CREATE TABLE IF NOT EXISTS `inventario`.`item` ( + `iditem` INT NOT NULL AUTO_INCREMENT, + `fecha_alta` DATE NULL, + `fecha_modificacion` DATE NULL, + `users_id` BIGINT NOT NULL, + `ubicacion_idubicacion` INT NOT NULL, + `producto_idproducto` INT NOT NULL, + PRIMARY KEY (`iditem`), + INDEX `fk_item_users1_idx` (`users_id` ASC) VISIBLE, + INDEX `fk_item_ubicacion1_idx` (`ubicacion_idubicacion` ASC) VISIBLE, + INDEX `fk_item_producto1_idx` (`producto_idproducto` ASC) VISIBLE, + CONSTRAINT `fk_item_users1` + FOREIGN KEY (`users_id`) + REFERENCES `inventario`.`users` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_item_ubicacion1` + FOREIGN KEY (`ubicacion_idubicacion`) + REFERENCES `inventario`.`ubicacion` (`idubicacion`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_item_producto1` + FOREIGN KEY (`producto_idproducto`) + REFERENCES `inventario`.`producto` (`idproducto`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `inventario`.`valor` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `inventario`.`valor` ; + +CREATE TABLE IF NOT EXISTS `inventario`.`valor` ( + `idvalor` INT NOT NULL AUTO_INCREMENT, + `valor` VARCHAR(255) NULL, + `propiedad_idpropiedad` INT NOT NULL, + `item_iditem` INT NOT NULL, + PRIMARY KEY (`idvalor`), + INDEX `fk_valor_propiedad1_idx` (`propiedad_idpropiedad` ASC) VISIBLE, + INDEX `fk_valor_item1_idx` (`item_iditem` ASC) VISIBLE, + CONSTRAINT `fk_valor_propiedad1` + FOREIGN KEY (`propiedad_idpropiedad`) + REFERENCES `inventario`.`propiedad` (`idpropiedad`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_valor_item1` + FOREIGN KEY (`item_iditem`) + REFERENCES `inventario`.`item` (`iditem`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB; + + +SET SQL_MODE=@OLD_SQL_MODE; +SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; +SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; diff --git a/src/main/resources/templates/home.html b/src/main/resources/templates/home.html index 0c28f6b..3511d97 100644 --- a/src/main/resources/templates/home.html +++ b/src/main/resources/templates/home.html @@ -21,4 +21,4 @@ - \ No newline at end of file +