aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2018-11-09 04:53:58 +0100
committerTeddy Wing2018-11-09 04:53:58 +0100
commit9f00878e27f8729112367f832dc6191c1ccc3d3f (patch)
tree94c4782dab1900ac3e84a6febdf1174d4e3c9a21
parent33650e273ff186c587ee09d60a6e2e8424dbd380 (diff)
downloaddome-key-web-9f00878e27f8729112367f832dc6191c1ccc3d3f.tar.bz2
20181109031633_create_purchasers.up.sql: Remove `DELIMITER` lines
Running $ mysql -u user dome_key < 20181109031633_create_purchasers.up.sql worked just fine, but running the migration through 'migrate' produced this error: (details: Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DELIMITER $$ CREATE TRIGGER purchasers_updated_at BEFORE UPDATE ON purchasers FO' at line 1) Probably the same problem that 'migrant' had, but it just didn't give me an error message. After having to fiddle and mess around with different parts of the migration for a while, it finally turned out that the `DELIMITER` seemed to be the problem. Got rid of it as well as the `BEGIN`/`END` that depended on it. Looks like our timestamp updater still works even without `BEGIN`, though, so that's good. When I had first written the code, I figured I should use `BEGIN` because that was how it was written in a couple examples I had seen.
-rw-r--r--license-generator/migrations/20181109031633_create_purchasers.up.sql6
1 files changed, 1 insertions, 5 deletions
diff --git a/license-generator/migrations/20181109031633_create_purchasers.up.sql b/license-generator/migrations/20181109031633_create_purchasers.up.sql
index 14927c2..8bf597c 100644
--- a/license-generator/migrations/20181109031633_create_purchasers.up.sql
+++ b/license-generator/migrations/20181109031633_create_purchasers.up.sql
@@ -9,13 +9,9 @@ CREATE TABLE purchasers (
updated_at DATETIME NOT NULL DEFAULT UTC_TIMESTAMP()
);
-DELIMITER $$
- CREATE TRIGGER purchasers_updated_at
+CREATE TRIGGER purchasers_updated_at
BEFORE UPDATE
ON purchasers FOR EACH ROW
- BEGIN
SET NEW.updated_at = UTC_TIMESTAMP();
- END$$
-DELIMITER ;
COMMIT;