diff options
Diffstat (limited to 'license-generator/migrations/20181109031633_create_purchasers.up.sql')
-rw-r--r-- | license-generator/migrations/20181109031633_create_purchasers.up.sql | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/license-generator/migrations/20181109031633_create_purchasers.up.sql b/license-generator/migrations/20181109031633_create_purchasers.up.sql index 8bf597c..19669bd 100644 --- a/license-generator/migrations/20181109031633_create_purchasers.up.sql +++ b/license-generator/migrations/20181109031633_create_purchasers.up.sql @@ -5,11 +5,21 @@ CREATE TABLE purchasers ( name VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, secret VARCHAR(255), - created_at DATETIME NOT NULL DEFAULT UTC_TIMESTAMP(), - updated_at DATETIME NOT NULL DEFAULT UTC_TIMESTAMP() + created_at DATETIME NOT NULL, + updated_at DATETIME NOT NULL ); -CREATE TRIGGER purchasers_updated_at +CREATE TRIGGER purchasers_created_at_before_insert + BEFORE INSERT + ON purchasers FOR EACH ROW + SET 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 BEFORE UPDATE ON purchasers FOR EACH ROW SET NEW.updated_at = UTC_TIMESTAMP(); |