From 6875e7da114fdc022f2794bcc2ba308eff0ba222 Mon Sep 17 00:00:00 2001 From: Bernat Date: Tue, 2 Oct 2018 07:28:12 +0200 Subject: [PATCH] update structure db --- .../{04-itemCategory.sql => 01-itemCategory.sql} | 0 services/db/install/changes/1.2-CHECK/02-clentLog.sql | 2 ++ .../changes/1.2-CHECK/03-clientLogBeforeInsert.sql | 11 +++++++++++ 3 files changed, 13 insertions(+) rename services/db/install/changes/1.2-CHECK/{04-itemCategory.sql => 01-itemCategory.sql} (100%) create mode 100644 services/db/install/changes/1.2-CHECK/02-clentLog.sql create mode 100644 services/db/install/changes/1.2-CHECK/03-clientLogBeforeInsert.sql diff --git a/services/db/install/changes/1.2-CHECK/04-itemCategory.sql b/services/db/install/changes/1.2-CHECK/01-itemCategory.sql similarity index 100% rename from services/db/install/changes/1.2-CHECK/04-itemCategory.sql rename to services/db/install/changes/1.2-CHECK/01-itemCategory.sql diff --git a/services/db/install/changes/1.2-CHECK/02-clentLog.sql b/services/db/install/changes/1.2-CHECK/02-clentLog.sql new file mode 100644 index 000000000..76ba2a65d --- /dev/null +++ b/services/db/install/changes/1.2-CHECK/02-clentLog.sql @@ -0,0 +1,2 @@ +ALTER TABLE `vn`.`clientLog` +CHANGE COLUMN `newInstance` `newInstance` TEXT NULL DEFAULT NULL ; diff --git a/services/db/install/changes/1.2-CHECK/03-clientLogBeforeInsert.sql b/services/db/install/changes/1.2-CHECK/03-clientLogBeforeInsert.sql new file mode 100644 index 000000000..357f2a80d --- /dev/null +++ b/services/db/install/changes/1.2-CHECK/03-clientLogBeforeInsert.sql @@ -0,0 +1,11 @@ +DROP TRIGGER IF EXISTS `vn`.`clientLog_BEFORE_INSERT`; + +DELIMITER $$ +USE `vn`$$ +CREATE DEFINER=`root`@`%` TRIGGER `vn`.`clientLog_BEFORE_INSERT` BEFORE INSERT ON `clientLog` FOR EACH ROW +BEGIN + IF NEW.newInstance is NULL THEN + SET NEW.newInstance = NEW.description; + END IF; +END$$ +DELIMITER ;