aboutsummaryrefslogtreecommitdiffstats
path: root/license-generator/migrations
AgeCommit message (Collapse)Author
2018-11-0920181109031633_create_purchasers.up.sql: Remove `DELIMITER` linesTeddy Wing
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.
2018-11-09Move 'migrant' migrations to 'migrate' formatTeddy Wing
Switched migration runners from https://crates.io/crates/migrant to https://github.com/golang-migrate/migrate .
2018-11-09Add migrations for `purchasers` tableTeddy Wing
A database table to hold purchaser information so we can re-generate licenses in case purchasers lose their license keys. Needed to use a trigger to update the `updated_at` field on `UPDATE` as you can't do `ON UPDATE UTC_TIMESTAMP()` in the column definition > You can not specify UTC_TIMESTAMP as default to specify automatic > properties (https://dba.stackexchange.com/questions/20217/mysql-set-utc-time-as-default-timestamp/21619#21619) Weirdly, the trigger isn't working when applying the migration with $ migrant apply but it is working when running $ mysql -u user dome_key < migrations/20181108234653_create-purchasers/up.sql Not sure what's going on there, but 'migrant' appears to have trouble realising there are errors coming back from MySQL and executes the migrations regardless. It also doesn't print syntax error messages from MySQL which is very inconvenient. Migrant seemed to be the most advanced migration CLI on crates.io, and I was hoping to use a Rust program for this, but for simplicity, I'm thinking I'll have to go with a different migration runner. Considering https://github.com/golang-migrate/migrate.