salix/db/versions/.archive/10373-salmonHydrangea/00-firstScript.sql

30 lines
1.4 KiB
SQL

CREATE TABLE vn.expeditionMistakeType (
code VARCHAR(15) NOT NULL,
description varchar(45) NOT NULL,
CONSTRAINT packagingTypeMistake_PK PRIMARY KEY (code)
)
ENGINE=InnoDB
DEFAULT CHARSET=utf8mb3
COLLATE=utf8mb3_unicode_ci;
CREATE TABLE vn.expeditionMistake (
expeditionFk INT NOT NULL,
workerFk INT(10) unsigned NOT NULL COMMENT 'Quien marca el error',
typeFk VARCHAR(15) NOT NULL,
created TIMESTAMP DEFAULT current_timestamp() NOT NULL,
CONSTRAINT expeditionMistake_PK PRIMARY KEY (expeditionFk ),
CONSTRAINT expeditionMistake_FK FOREIGN KEY (expeditionFk) REFERENCES vn.expedition(id) ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT expeditionMistake_FK_1 FOREIGN KEY (workerfk) REFERENCES vn.worker(id) ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT expeditionMistake_FK_2 FOREIGN KEY (typeFk) REFERENCES vn.expeditionMistakeType(code) ON DELETE RESTRICT ON UPDATE CASCADE
)
ENGINE=InnoDB
DEFAULT CHARSET=utf8mb3
COLLATE=utf8mb3_unicode_ci
COMMENT='Errores de encajadores';
INSERT INTO vn.expeditionMistakeType (code, description) VALUES('bpc', 'Mal encajado');
INSERT INTO vn.expeditionMistakeType (code, description) VALUES('mex', 'Mezcla de pedidos');
INSERT INTO vn.silexACL ( module, `method`, `role`) VALUES( 'almacennew', 'expeditionMistakeType_get', 'employee');
INSERT INTO vn.silexACL ( module, `method`, `role`) VALUES( 'almacennew', 'expeditionMistake_add', 'employee');