aboutsummaryrefslogtreecommitdiffstats
path: root/license-generator/migrations/20181109031633_create_purchasers.up.sql
diff options
context:
space:
mode:
Diffstat (limited to 'license-generator/migrations/20181109031633_create_purchasers.up.sql')
-rw-r--r--license-generator/migrations/20181109031633_create_purchasers.up.sql13
1 files changed, 5 insertions, 8 deletions
diff --git a/license-generator/migrations/20181109031633_create_purchasers.up.sql b/license-generator/migrations/20181109031633_create_purchasers.up.sql
index 19669bd..7c6bffd 100644
--- a/license-generator/migrations/20181109031633_create_purchasers.up.sql
+++ b/license-generator/migrations/20181109031633_create_purchasers.up.sql
@@ -9,17 +9,14 @@ CREATE TABLE purchasers (
updated_at DATETIME NOT NULL
);
-CREATE TRIGGER purchasers_created_at_before_insert
+CREATE TRIGGER purchasers_before_insert
BEFORE INSERT
ON purchasers FOR EACH ROW
- SET NEW.created_at = UTC_TIMESTAMP();
+ SET
+ NEW.updated_at = UTC_TIMESTAMP(),
+ NEW.created_at = UTC_TIMESTAMP();
-CREATE TRIGGER purchasers_updated_at_before_insert
- BEFORE INSERT
- ON purchasers FOR EACH ROW
- SET NEW.updated_at = UTC_TIMESTAMP();
-
-CREATE TRIGGER purchasers_updated_at_before_update
+CREATE TRIGGER purchasers_before_update
BEFORE UPDATE
ON purchasers FOR EACH ROW
SET NEW.updated_at = UTC_TIMESTAMP();