Performance: Migrations for schema changes
MEDIUM IMPACT
This affects page load speed indirectly by controlling database schema updates without blocking server responses or causing downtime.
const migrate = require('migrate'); migrate.load({}, (err, set) => { if (err) throw err; set.up((err) => { if (err) throw err; app.listen(3000, () => { console.log('Server started after migrations'); }); }); });
// Directly run ALTER TABLE queries before server start db.query('ALTER TABLE users ADD COLUMN age INT', (err) => { if (err) throw err; app.listen(3000, () => { console.log('Server started'); }); }); // Server blocks startup until migration finishes
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Synchronous migrations on server start | 0 | 0 | 0 | [X] Bad |
| Asynchronous migrations before server start | 0 | 0 | 0 | [OK] Good |