aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--license-generator/migrations/20181109031633_create_purchasers.down.sql5
-rw-r--r--license-generator/migrations/20181109031633_create_purchasers.up.sql13
2 files changed, 7 insertions, 11 deletions
diff --git a/license-generator/migrations/20181109031633_create_purchasers.down.sql b/license-generator/migrations/20181109031633_create_purchasers.down.sql
index 3fa17a5..ffdb8e9 100644
--- a/license-generator/migrations/20181109031633_create_purchasers.down.sql
+++ b/license-generator/migrations/20181109031633_create_purchasers.down.sql
@@ -1,8 +1,7 @@
BEGIN;
-DROP TRIGGER purchasers_created_at_before_insert;
-DROP TRIGGER purchasers_updated_at_before_insert;
-DROP TRIGGER purchasers_updated_at_before_update;
+DROP TRIGGER purchasers_before_insert;
+DROP TRIGGER purchasers_before_update;
DROP TABLE purchasers;
COMMIT;
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();