|
@ -1,5 +1,5 @@ |
|
|
-- MySQL Script generated by MySQL Workbench |
|
|
-- MySQL Script generated by MySQL Workbench |
|
|
-- Fri May 3 12:31:54 2024 |
|
|
-- Fri May 10 08:25:34 2024 |
|
|
-- Model: New Model Version: 1.0 |
|
|
-- Model: New Model Version: 1.0 |
|
|
-- MySQL Workbench Forward Engineering |
|
|
-- MySQL Workbench Forward Engineering |
|
|
|
|
|
|
|
@ -15,41 +15,42 @@ SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,N |
|
|
-- Schema sistemadeinventario |
|
|
-- Schema sistemadeinventario |
|
|
-- ----------------------------------------------------- |
|
|
-- ----------------------------------------------------- |
|
|
CREATE SCHEMA IF NOT EXISTS `sistemadeinventario` DEFAULT CHARACTER SET utf8 ; |
|
|
CREATE SCHEMA IF NOT EXISTS `sistemadeinventario` DEFAULT CHARACTER SET utf8 ; |
|
|
USE `sistemadeinventario` ; |
|
|
|
|
|
|
|
|
|
|
|
-- ----------------------------------------------------- |
|
|
-- ----------------------------------------------------- |
|
|
-- Table `sistemadeinventario`.`departamento` |
|
|
-- Schema sistemadeinventario |
|
|
-- ----------------------------------------------------- |
|
|
-- ----------------------------------------------------- |
|
|
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`departamento` ( |
|
|
|
|
|
`id` INT NOT NULL AUTO_INCREMENT, |
|
|
|
|
|
`nombre` VARCHAR(20) NULL, |
|
|
|
|
|
`anaquel` VARCHAR(15) NULL, |
|
|
|
|
|
`status` INT NULL, |
|
|
|
|
|
PRIMARY KEY (`id`)) |
|
|
|
|
|
ENGINE = InnoDB; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- ----------------------------------------------------- |
|
|
|
|
|
-- Schema sistemadeinventario |
|
|
|
|
|
-- ----------------------------------------------------- |
|
|
|
|
|
CREATE SCHEMA IF NOT EXISTS `sistemadeinventario` DEFAULT CHARACTER SET utf8 ; |
|
|
|
|
|
USE `sistemadeinventario` ; |
|
|
|
|
|
|
|
|
-- ----------------------------------------------------- |
|
|
-- ----------------------------------------------------- |
|
|
-- Table `sistemadeinventario`.`tipo` |
|
|
-- Table `sistemadeinventario`.`Registro` |
|
|
-- ----------------------------------------------------- |
|
|
-- ----------------------------------------------------- |
|
|
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`tipo` ( |
|
|
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`Registro` ( |
|
|
`id` INT NOT NULL AUTO_INCREMENT, |
|
|
`id` INT NOT NULL AUTO_INCREMENT, |
|
|
`nombre` VARCHAR(20) NULL, |
|
|
`Entrada` VARCHAR(10) NULL DEFAULT NULL, |
|
|
`status` INT NULL, |
|
|
`salida` VARCHAR(10) NULL DEFAULT NULL, |
|
|
|
|
|
`Alta` VARCHAR(45) NULL DEFAULT NULL, |
|
|
|
|
|
`baja` VARCHAR(45) NULL DEFAULT NULL, |
|
|
|
|
|
`status` INT NULL DEFAULT NULL, |
|
|
PRIMARY KEY (`id`)) |
|
|
PRIMARY KEY (`id`)) |
|
|
ENGINE = InnoDB; |
|
|
ENGINE = InnoDB; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- ----------------------------------------------------- |
|
|
-- ----------------------------------------------------- |
|
|
-- Table `sistemadeinventario`.`marca` |
|
|
-- Table `sistemadeinventario`.`departamento` |
|
|
-- ----------------------------------------------------- |
|
|
-- ----------------------------------------------------- |
|
|
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`marca` ( |
|
|
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`departamento` ( |
|
|
`id` INT NOT NULL AUTO_INCREMENT, |
|
|
`id` INT NOT NULL AUTO_INCREMENT, |
|
|
`nombre` VARCHAR(20) NULL, |
|
|
`nombre` VARCHAR(20) NULL DEFAULT NULL, |
|
|
`status` INT NULL, |
|
|
`anaquel` VARCHAR(15) NULL DEFAULT NULL, |
|
|
`rutafoto` VARCHAR(100) NULL, |
|
|
`status` INT NULL DEFAULT NULL, |
|
|
PRIMARY KEY (`id`)) |
|
|
PRIMARY KEY (`id`)) |
|
|
ENGINE = InnoDB; |
|
|
ENGINE = InnoDB |
|
|
|
|
|
AUTO_INCREMENT = 2 |
|
|
|
|
|
DEFAULT CHARACTER SET = utf8mb3; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- ----------------------------------------------------- |
|
|
-- ----------------------------------------------------- |
|
@ -57,9 +58,11 @@ ENGINE = InnoDB; |
|
|
-- ----------------------------------------------------- |
|
|
-- ----------------------------------------------------- |
|
|
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`pais` ( |
|
|
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`pais` ( |
|
|
`id` INT NOT NULL, |
|
|
`id` INT NOT NULL, |
|
|
`nombre` VARCHAR(45) NULL, |
|
|
`nombre` VARCHAR(45) NULL DEFAULT NULL, |
|
|
|
|
|
`status` INT NULL, |
|
|
PRIMARY KEY (`id`)) |
|
|
PRIMARY KEY (`id`)) |
|
|
ENGINE = InnoDB; |
|
|
ENGINE = InnoDB |
|
|
|
|
|
DEFAULT CHARACTER SET = utf8mb3; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- ----------------------------------------------------- |
|
|
-- ----------------------------------------------------- |
|
@ -67,16 +70,28 @@ ENGINE = InnoDB; |
|
|
-- ----------------------------------------------------- |
|
|
-- ----------------------------------------------------- |
|
|
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`estado` ( |
|
|
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`estado` ( |
|
|
`id` INT NOT NULL AUTO_INCREMENT, |
|
|
`id` INT NOT NULL AUTO_INCREMENT, |
|
|
`nombre` VARCHAR(45) NULL, |
|
|
`nombre` VARCHAR(45) NULL DEFAULT NULL, |
|
|
`pais_idpais` INT NOT NULL, |
|
|
`pais_idpais` INT NOT NULL, |
|
|
|
|
|
`status` INT NULL, |
|
|
PRIMARY KEY (`id`), |
|
|
PRIMARY KEY (`id`), |
|
|
INDEX `fk_estado_pais1_idx` (`pais_idpais` ASC) VISIBLE, |
|
|
INDEX `fk_estado_pais1_idx` (`pais_idpais` ASC) VISIBLE, |
|
|
CONSTRAINT `fk_estado_pais1` |
|
|
CONSTRAINT `fk_estado_pais1` |
|
|
FOREIGN KEY (`pais_idpais`) |
|
|
FOREIGN KEY (`pais_idpais`) |
|
|
REFERENCES `sistemadeinventario`.`pais` (`id`) |
|
|
REFERENCES `sistemadeinventario`.`pais` (`id`)) |
|
|
ON DELETE NO ACTION |
|
|
ENGINE = InnoDB |
|
|
ON UPDATE NO ACTION) |
|
|
DEFAULT CHARACTER SET = utf8mb3; |
|
|
ENGINE = InnoDB; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- ----------------------------------------------------- |
|
|
|
|
|
-- Table `sistemadeinventario`.`marca` |
|
|
|
|
|
-- ----------------------------------------------------- |
|
|
|
|
|
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`marca` ( |
|
|
|
|
|
`id` INT NOT NULL AUTO_INCREMENT, |
|
|
|
|
|
`nombre` VARCHAR(20) NULL DEFAULT NULL, |
|
|
|
|
|
`status` INT NULL DEFAULT NULL, |
|
|
|
|
|
PRIMARY KEY (`id`)) |
|
|
|
|
|
ENGINE = InnoDB |
|
|
|
|
|
DEFAULT CHARACTER SET = utf8mb3; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- ----------------------------------------------------- |
|
|
-- ----------------------------------------------------- |
|
@ -84,20 +99,31 @@ ENGINE = InnoDB; |
|
|
-- ----------------------------------------------------- |
|
|
-- ----------------------------------------------------- |
|
|
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`provedor` ( |
|
|
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`provedor` ( |
|
|
`id` INT NOT NULL AUTO_INCREMENT, |
|
|
`id` INT NOT NULL AUTO_INCREMENT, |
|
|
`nombre` VARCHAR(20) NULL, |
|
|
`nombre` VARCHAR(20) NULL DEFAULT NULL, |
|
|
`direccion` VARCHAR(20) NULL, |
|
|
`direccion` VARCHAR(20) NULL DEFAULT NULL, |
|
|
`correo` VARCHAR(15) NULL, |
|
|
`correo` VARCHAR(15) NULL DEFAULT NULL, |
|
|
`telefono` VARCHAR(10) NULL, |
|
|
`telefono` VARCHAR(10) NULL DEFAULT NULL, |
|
|
`status` INT NULL, |
|
|
`status` INT NULL DEFAULT NULL, |
|
|
`estado_idestado` INT NOT NULL, |
|
|
`estado_idestado` INT NOT NULL, |
|
|
PRIMARY KEY (`id`), |
|
|
PRIMARY KEY (`id`), |
|
|
INDEX `fk_provedor_estado1_idx` (`estado_idestado` ASC) VISIBLE, |
|
|
INDEX `fk_provedor_estado1_idx` (`estado_idestado` ASC) VISIBLE, |
|
|
CONSTRAINT `fk_provedor_estado1` |
|
|
CONSTRAINT `fk_provedor_estado1` |
|
|
FOREIGN KEY (`estado_idestado`) |
|
|
FOREIGN KEY (`estado_idestado`) |
|
|
REFERENCES `sistemadeinventario`.`estado` (`id`) |
|
|
REFERENCES `sistemadeinventario`.`estado` (`id`)) |
|
|
ON DELETE NO ACTION |
|
|
ENGINE = InnoDB |
|
|
ON UPDATE NO ACTION) |
|
|
DEFAULT CHARACTER SET = utf8mb3; |
|
|
ENGINE = InnoDB; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- ----------------------------------------------------- |
|
|
|
|
|
-- Table `sistemadeinventario`.`tipo` |
|
|
|
|
|
-- ----------------------------------------------------- |
|
|
|
|
|
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`tipo` ( |
|
|
|
|
|
`id` INT NOT NULL AUTO_INCREMENT, |
|
|
|
|
|
`nombre` VARCHAR(20) NULL DEFAULT NULL, |
|
|
|
|
|
`status` INT NULL DEFAULT NULL, |
|
|
|
|
|
PRIMARY KEY (`id`)) |
|
|
|
|
|
ENGINE = InnoDB |
|
|
|
|
|
DEFAULT CHARACTER SET = utf8mb3; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- ----------------------------------------------------- |
|
|
-- ----------------------------------------------------- |
|
@ -105,17 +131,17 @@ ENGINE = InnoDB; |
|
|
-- ----------------------------------------------------- |
|
|
-- ----------------------------------------------------- |
|
|
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`producto` ( |
|
|
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`producto` ( |
|
|
`id` INT NOT NULL AUTO_INCREMENT, |
|
|
`id` INT NOT NULL AUTO_INCREMENT, |
|
|
`cantidad` VARCHAR(10) NULL, |
|
|
`cantidad` VARCHAR(10) NULL DEFAULT NULL, |
|
|
`nombre` VARCHAR(20) NULL, |
|
|
`nombre` VARCHAR(20) NULL DEFAULT NULL, |
|
|
`precio` INT NULL, |
|
|
`precio` INT NULL DEFAULT NULL, |
|
|
`codigoBarras` VARCHAR(15) NULL, |
|
|
`codigoBarras` VARCHAR(15) NULL DEFAULT NULL, |
|
|
`medida` INT NULL, |
|
|
`medida` INT NULL DEFAULT NULL, |
|
|
`lote` VARCHAR(10) NULL, |
|
|
`lote` VARCHAR(10) NULL DEFAULT NULL, |
|
|
`departamento_id` INT NOT NULL, |
|
|
`departamento_id` INT NOT NULL, |
|
|
`tipo_idtipo` INT NOT NULL, |
|
|
`tipo_idtipo` INT NOT NULL, |
|
|
`marca_idmarca` INT NOT NULL, |
|
|
`marca_idmarca` INT NOT NULL, |
|
|
`provedor_idprovedor` INT NOT NULL, |
|
|
`provedor_idprovedor` INT NOT NULL, |
|
|
`status` INT NULL, |
|
|
`status` INT NULL DEFAULT NULL, |
|
|
PRIMARY KEY (`id`), |
|
|
PRIMARY KEY (`id`), |
|
|
INDEX `fk_producto_departamento_idx` (`departamento_id` ASC) VISIBLE, |
|
|
INDEX `fk_producto_departamento_idx` (`departamento_id` ASC) VISIBLE, |
|
|
INDEX `fk_producto_tipo1_idx` (`tipo_idtipo` ASC) VISIBLE, |
|
|
INDEX `fk_producto_tipo1_idx` (`tipo_idtipo` ASC) VISIBLE, |
|
@ -123,25 +149,18 @@ CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`producto` ( |
|
|
INDEX `fk_producto_provedor1_idx` (`provedor_idprovedor` ASC) VISIBLE, |
|
|
INDEX `fk_producto_provedor1_idx` (`provedor_idprovedor` ASC) VISIBLE, |
|
|
CONSTRAINT `fk_producto_departamento` |
|
|
CONSTRAINT `fk_producto_departamento` |
|
|
FOREIGN KEY (`departamento_id`) |
|
|
FOREIGN KEY (`departamento_id`) |
|
|
REFERENCES `sistemadeinventario`.`departamento` (`id`) |
|
|
REFERENCES `sistemadeinventario`.`departamento` (`id`), |
|
|
ON DELETE NO ACTION |
|
|
|
|
|
ON UPDATE NO ACTION, |
|
|
|
|
|
CONSTRAINT `fk_producto_tipo1` |
|
|
|
|
|
FOREIGN KEY (`tipo_idtipo`) |
|
|
|
|
|
REFERENCES `sistemadeinventario`.`tipo` (`id`) |
|
|
|
|
|
ON DELETE NO ACTION |
|
|
|
|
|
ON UPDATE NO ACTION, |
|
|
|
|
|
CONSTRAINT `fk_producto_marca1` |
|
|
CONSTRAINT `fk_producto_marca1` |
|
|
FOREIGN KEY (`marca_idmarca`) |
|
|
FOREIGN KEY (`marca_idmarca`) |
|
|
REFERENCES `sistemadeinventario`.`marca` (`id`) |
|
|
REFERENCES `sistemadeinventario`.`marca` (`id`), |
|
|
ON DELETE NO ACTION |
|
|
|
|
|
ON UPDATE NO ACTION, |
|
|
|
|
|
CONSTRAINT `fk_producto_provedor1` |
|
|
CONSTRAINT `fk_producto_provedor1` |
|
|
FOREIGN KEY (`provedor_idprovedor`) |
|
|
FOREIGN KEY (`provedor_idprovedor`) |
|
|
REFERENCES `sistemadeinventario`.`provedor` (`id`) |
|
|
REFERENCES `sistemadeinventario`.`provedor` (`id`), |
|
|
ON DELETE NO ACTION |
|
|
CONSTRAINT `fk_producto_tipo1` |
|
|
ON UPDATE NO ACTION) |
|
|
FOREIGN KEY (`tipo_idtipo`) |
|
|
ENGINE = InnoDB; |
|
|
REFERENCES `sistemadeinventario`.`tipo` (`id`)) |
|
|
|
|
|
ENGINE = InnoDB |
|
|
|
|
|
DEFAULT CHARACTER SET = utf8mb3; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- ----------------------------------------------------- |
|
|
-- ----------------------------------------------------- |
|
@ -149,9 +168,11 @@ ENGINE = InnoDB; |
|
|
-- ----------------------------------------------------- |
|
|
-- ----------------------------------------------------- |
|
|
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`rol` ( |
|
|
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`rol` ( |
|
|
`id` INT NOT NULL AUTO_INCREMENT, |
|
|
`id` INT NOT NULL AUTO_INCREMENT, |
|
|
`nombre` VARCHAR(20) NULL, |
|
|
`nombre` VARCHAR(20) NULL DEFAULT NULL, |
|
|
|
|
|
`status` INT NULL, |
|
|
PRIMARY KEY (`id`)) |
|
|
PRIMARY KEY (`id`)) |
|
|
ENGINE = InnoDB; |
|
|
ENGINE = InnoDB |
|
|
|
|
|
DEFAULT CHARACTER SET = utf8mb3; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- ----------------------------------------------------- |
|
|
-- ----------------------------------------------------- |
|
@ -159,32 +180,29 @@ ENGINE = InnoDB; |
|
|
-- ----------------------------------------------------- |
|
|
-- ----------------------------------------------------- |
|
|
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`usuario` ( |
|
|
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`usuario` ( |
|
|
`id` INT NOT NULL AUTO_INCREMENT, |
|
|
`id` INT NOT NULL AUTO_INCREMENT, |
|
|
`nombre` VARCHAR(45) NULL, |
|
|
`nombre` VARCHAR(45) NULL DEFAULT NULL, |
|
|
`sexo` CHAR NULL, |
|
|
`sexo` CHAR(1) NULL DEFAULT NULL, |
|
|
`telefono` VARCHAR(10) NULL, |
|
|
`telefono` VARCHAR(10) NULL DEFAULT NULL, |
|
|
`correo` VARCHAR(20) NULL, |
|
|
`correo` VARCHAR(20) NULL DEFAULT NULL, |
|
|
`direccion` VARCHAR(40) NULL, |
|
|
`direccion` VARCHAR(40) NULL DEFAULT NULL, |
|
|
`status` INT NULL, |
|
|
`status` INT NULL DEFAULT NULL, |
|
|
`npila` VARCHAR(15) NULL, |
|
|
`npila` VARCHAR(15) NULL DEFAULT NULL, |
|
|
`username` VARCHAR(20) NULL, |
|
|
`username` VARCHAR(20) NULL DEFAULT NULL, |
|
|
`rutafoto` VARCHAR(100) NULL, |
|
|
|
|
|
`rol_idrol` INT NOT NULL, |
|
|
`rol_idrol` INT NOT NULL, |
|
|
`estado_idestado` INT NOT NULL, |
|
|
`estado_idestado` INT NOT NULL, |
|
|
PRIMARY KEY (`id`), |
|
|
PRIMARY KEY (`id`), |
|
|
INDEX `fk_usuario_rol1_idx` (`rol_idrol` ASC) VISIBLE, |
|
|
INDEX `fk_usuario_rol1_idx` (`rol_idrol` ASC) VISIBLE, |
|
|
INDEX `fk_usuario_estado1_idx` (`estado_idestado` ASC) VISIBLE, |
|
|
INDEX `fk_usuario_estado1_idx` (`estado_idestado` ASC) VISIBLE, |
|
|
CONSTRAINT `fk_usuario_rol1` |
|
|
|
|
|
FOREIGN KEY (`rol_idrol`) |
|
|
|
|
|
REFERENCES `sistemadeinventario`.`rol` (`id`) |
|
|
|
|
|
ON DELETE NO ACTION |
|
|
|
|
|
ON UPDATE NO ACTION, |
|
|
|
|
|
CONSTRAINT `fk_usuario_estado1` |
|
|
CONSTRAINT `fk_usuario_estado1` |
|
|
FOREIGN KEY (`estado_idestado`) |
|
|
FOREIGN KEY (`estado_idestado`) |
|
|
REFERENCES `sistemadeinventario`.`estado` (`id`) |
|
|
REFERENCES `sistemadeinventario`.`estado` (`id`), |
|
|
ON DELETE NO ACTION |
|
|
CONSTRAINT `fk_usuario_rol1` |
|
|
ON UPDATE NO ACTION) |
|
|
FOREIGN KEY (`rol_idrol`) |
|
|
ENGINE = InnoDB; |
|
|
REFERENCES `sistemadeinventario`.`rol` (`id`)) |
|
|
|
|
|
ENGINE = InnoDB |
|
|
|
|
|
DEFAULT CHARACTER SET = utf8mb3; |
|
|
|
|
|
|
|
|
|
|
|
USE `sistemadeinventario` ; |
|
|
|
|
|
|
|
|
SET SQL_MODE=@OLD_SQL_MODE; |
|
|
SET SQL_MODE=@OLD_SQL_MODE; |
|
|
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; |
|
|
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; |
|
|