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 = 'TRADITIONAL';
-- -----------------------------------------------------
USE `logpro`;
-- -----------------------------------------------------
-- Table `logpro`.`blumar_stocks`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `logpro`.`blumar_stocks`
(
  `creacion`           TIMESTAMP                    NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `creador_id`         INT(3) UNSIGNED              NOT NULL,
  `centro`             VARCHAR(20)                  NULL,
  `material`           VARCHAR(40)                  NOT NULL,
  `carga_ref`          VARCHAR(50)                  NULL,
  `almacen_codigo`     VARCHAR(10)                  NULL,
  `almacen_nombre`     VARCHAR(100)                 NULL,
  `cantidad`           INT UNSIGNED                 NOT NULL,
  `unidad_medida`      VARCHAR(20)                  NULL,
  `lote`               INT UNSIGNED                 NULL,
  `tipo_material`      VARCHAR(20)                  NULL,
  `grupo_articulos`    VARCHAR(20)                  NULL,
  PRIMARY KEY (`material_id`, `almacen_codigo`),
  INDEX `fk_blumar_stocks_creadores` (`creador_id` ASC),
  CONSTRAINT `fk_blumar_stocks_creadores`
    FOREIGN KEY (`creador_id`)
      REFERENCES `logpro`.`sistema_usuarios` (`id`)
      ON DELETE RESTRICT
      ON UPDATE CASCADE
)
  ENGINE = InnoDB
  DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
SET SQL_MODE = @OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS = @OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS = @OLD_UNIQUE_CHECKS;