fixes fatal error from landing https://phab.comm.dev/D5494
Details
Ran yarn dev in keyserver and:
- Confirmed migration 7 ran by checking the logs for the following:
[NODEM] (node:90015) DB version: 6 [NODEM] (node:90015) migration 7 succeeded.
- Confirmed that the MySQL tables looks as expected by inspecting with the mysql CLI utility
Tested the above for three distinct scenarios:
- Somebody has a broken setup due to the issues introduced in the previous diff (ran broken migration 6)
- Somebody has never run any migration 6 and still has the columns
- Somebody has never run any migration 6 and DOESN'T have these columns
To test all of these scenarios, I ran the following queries to undo the migration:
ALTER TABLE users ADD COLUMN public_key char(116) DEFAULT NULL, MODIFY hash char(60) COLLATE utf8mb4_bin NOT NULL; ALTER TABLE sessions ADD COLUMN public_key char(116) DEFAULT NULL; UPDATE metadata SET data = 5 WHERE name = "db_version";
Diff Detail
- Repository
- rCOMM Comm
- Branch
- master
- Lint
No Lint Coverage - Unit
No Test Coverage
Event Timeline
Based on chat correspondence it seems like your understanding of the MariaDB migrations code is incomplete. Can you brush up on it and then update the test plan here to clarify exactly how you are making sure your code is being run? A simple console.log next to your await dbQuery line would probably be enough to verify if it's being called or not...
By the way, you still need to make sure your queries are idempotent. Please also update your test plan to:
- Cover testing the scenario where somebody has a broken setup due to the issues introduced in your previous diff (ran broken migration 6)
- Cover testing the scenario where somebody has never run any migration 6 and doesn't have these columns
- Cover testing the scenario where somebody has never run any migration 6 and DOES have these columns (presumably this has happened to you, since you introduced these columns manually via a script before running the migration)
By the way, you might need to bump the migration version here if you want your new query to run in the "has already run broken migration 6" scenario... (not sure if the migration version got bumped in that scenario or not)
i definitely need to brush up on my migration understanding - in the process of running those tests. will update diff & rerequest shortly
Please update test plan as requested above
keyserver/src/database/migration-config.js | ||
---|---|---|
61 ↗ | (On Diff #18035) | Indents look weird, can we undo this change? |
keyserver/src/database/migration-config.js | ||
---|---|---|
61 ↗ | (On Diff #18035) | this is prettier's auto-formatting |
keyserver/src/database/migration-config.js | ||
---|---|---|
61 ↗ | (On Diff #18035) | While it's true that Prettier messed up the formatting due to the introduction of a second parameter to dbQuery, it's not true that Prettier insists on this broken indentation. See my upcoming update |