salix/services/db/01-titemLog.sql

18 lines
489 B
SQL

CREATE TABLE vn.itemLog
SELECT * FROM vn.entryLog LIMIT 0;
ALTER TABLE `vn`.`itemLog`
ADD INDEX `itemLogItemFk_idx` (`originFk` ASC),
ADD INDEX `itemLogUserFk_idx` (`userFk` ASC);
ALTER TABLE `vn`.`itemLog`
ADD CONSTRAINT `itemLogItemFk`
FOREIGN KEY (`originFk`)
REFERENCES `vn2008`.`Articles` (`Id_Article`)
ON DELETE NO ACTION
ON UPDATE CASCADE,
ADD CONSTRAINT `itemLogUserFk`
FOREIGN KEY (`userFk`)
REFERENCES `account`.`user` (`id`)
ON DELETE NO ACTION
ON UPDATE CASCADE;