Administrador de la clase de jakarta, un sistema de inventario
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

209 lines
7.6 KiB

-- MySQL Script generated by MySQL Workbench
-- Fri May 10 08:25:34 2024
-- Model: New Model Version: 1.0
-- 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 sistemadeinventario
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema sistemadeinventario
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `sistemadeinventario` DEFAULT CHARACTER SET utf8 ;
-- -----------------------------------------------------
-- Schema sistemadeinventario
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema sistemadeinventario
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `sistemadeinventario` DEFAULT CHARACTER SET utf8 ;
USE `sistemadeinventario` ;
-- -----------------------------------------------------
-- Table `sistemadeinventario`.`Registro`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`Registro` (
`id` INT NOT NULL AUTO_INCREMENT,
`Entrada` VARCHAR(10) NULL DEFAULT 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`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `sistemadeinventario`.`departamento`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`departamento` (
`id` INT NOT NULL AUTO_INCREMENT,
`nombre` VARCHAR(20) NULL DEFAULT NULL,
`anaquel` VARCHAR(15) NULL DEFAULT NULL,
`status` INT NULL DEFAULT NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB
AUTO_INCREMENT = 2
DEFAULT CHARACTER SET = utf8mb3;
-- -----------------------------------------------------
-- Table `sistemadeinventario`.`pais`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`pais` (
`id` INT NOT NULL,
`nombre` VARCHAR(45) NULL DEFAULT NULL,
`status` INT NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb3;
-- -----------------------------------------------------
-- Table `sistemadeinventario`.`estado`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`estado` (
`id` INT NOT NULL AUTO_INCREMENT,
`nombre` VARCHAR(45) NULL DEFAULT NULL,
`pais_idpais` INT NOT NULL,
`status` INT NULL,
PRIMARY KEY (`id`),
INDEX `fk_estado_pais1_idx` (`pais_idpais` ASC) VISIBLE,
CONSTRAINT `fk_estado_pais1`
FOREIGN KEY (`pais_idpais`)
REFERENCES `sistemadeinventario`.`pais` (`id`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb3;
-- -----------------------------------------------------
-- 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;
-- -----------------------------------------------------
-- Table `sistemadeinventario`.`provedor`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`provedor` (
`id` INT NOT NULL AUTO_INCREMENT,
`nombre` VARCHAR(20) NULL DEFAULT NULL,
`direccion` VARCHAR(20) NULL DEFAULT NULL,
`correo` VARCHAR(15) NULL DEFAULT NULL,
`telefono` VARCHAR(10) NULL DEFAULT NULL,
`status` INT NULL DEFAULT NULL,
`estado_idestado` INT NOT NULL,
PRIMARY KEY (`id`),
INDEX `fk_provedor_estado1_idx` (`estado_idestado` ASC) VISIBLE,
CONSTRAINT `fk_provedor_estado1`
FOREIGN KEY (`estado_idestado`)
REFERENCES `sistemadeinventario`.`estado` (`id`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb3;
-- -----------------------------------------------------
-- 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;
-- -----------------------------------------------------
-- Table `sistemadeinventario`.`producto`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`producto` (
`id` INT NOT NULL AUTO_INCREMENT,
`cantidad` VARCHAR(10) NULL DEFAULT NULL,
`nombre` VARCHAR(20) NULL DEFAULT NULL,
`precio` INT NULL DEFAULT NULL,
`codigoBarras` VARCHAR(15) NULL DEFAULT NULL,
`medida` INT NULL DEFAULT NULL,
`lote` VARCHAR(10) NULL DEFAULT NULL,
`departamento_id` INT NOT NULL,
`tipo_idtipo` INT NOT NULL,
`marca_idmarca` INT NOT NULL,
`provedor_idprovedor` INT NOT NULL,
`status` INT NULL DEFAULT NULL,
PRIMARY KEY (`id`),
INDEX `fk_producto_departamento_idx` (`departamento_id` ASC) VISIBLE,
INDEX `fk_producto_tipo1_idx` (`tipo_idtipo` ASC) VISIBLE,
INDEX `fk_producto_marca1_idx` (`marca_idmarca` ASC) VISIBLE,
INDEX `fk_producto_provedor1_idx` (`provedor_idprovedor` ASC) VISIBLE,
CONSTRAINT `fk_producto_departamento`
FOREIGN KEY (`departamento_id`)
REFERENCES `sistemadeinventario`.`departamento` (`id`),
CONSTRAINT `fk_producto_marca1`
FOREIGN KEY (`marca_idmarca`)
REFERENCES `sistemadeinventario`.`marca` (`id`),
CONSTRAINT `fk_producto_provedor1`
FOREIGN KEY (`provedor_idprovedor`)
REFERENCES `sistemadeinventario`.`provedor` (`id`),
CONSTRAINT `fk_producto_tipo1`
FOREIGN KEY (`tipo_idtipo`)
REFERENCES `sistemadeinventario`.`tipo` (`id`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb3;
-- -----------------------------------------------------
-- Table `sistemadeinventario`.`rol`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`rol` (
`id` INT NOT NULL AUTO_INCREMENT,
`nombre` VARCHAR(20) NULL DEFAULT NULL,
`status` INT NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb3;
-- -----------------------------------------------------
-- Table `sistemadeinventario`.`usuario`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`usuario` (
`id` INT NOT NULL AUTO_INCREMENT,
`nombre` VARCHAR(45) NULL DEFAULT NULL,
`sexo` CHAR(1) NULL DEFAULT NULL,
`telefono` VARCHAR(10) NULL DEFAULT NULL,
`correo` VARCHAR(20) NULL DEFAULT NULL,
`direccion` VARCHAR(40) NULL DEFAULT NULL,
`status` INT NULL DEFAULT NULL,
`npila` VARCHAR(15) NULL DEFAULT NULL,
`username` VARCHAR(20) NULL DEFAULT NULL,
`rol_idrol` INT NOT NULL,
`estado_idestado` INT NOT NULL,
PRIMARY KEY (`id`),
INDEX `fk_usuario_rol1_idx` (`rol_idrol` ASC) VISIBLE,
INDEX `fk_usuario_estado1_idx` (`estado_idestado` ASC) VISIBLE,
CONSTRAINT `fk_usuario_estado1`
FOREIGN KEY (`estado_idestado`)
REFERENCES `sistemadeinventario`.`estado` (`id`),
CONSTRAINT `fk_usuario_rol1`
FOREIGN KEY (`rol_idrol`)
REFERENCES `sistemadeinventario`.`rol` (`id`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb3;
USE `sistemadeinventario` ;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;