Infrastructure only — no existing data or tables modified.
src/db/migrate.js — programmatic runner, fires at boot after
the existing idempotent initDatabase()
migrations/1744600000000... — intentionally empty example, documents
the file shape. Registered in the new
pgmigrations tracking table so it won't
rerun.
.node-pg-migraterc.json — CLI config (migrations-dir, utc naming)
docs/migrations.md — workflow + conventions
package.json — migrate:up/down/new/status npm scripts
(status is a direct pgmigrations query
since node-pg-migrate v7 lacks a status
subcommand)
src/utils/sessions.js:
- parseUserAgent now recognizes the Capacitor wrapper (UA suffix
"PedScribe-Android" / "PedScribe-iOS") and labels sessions
"PedScribe (Android)" instead of "Chrome on Android".
Going forward: schema changes go in /migrations as versioned files
with up() + down(); the inline init in database.js is the implicit
baseline for everything already in production.
29 lines
783 B
JavaScript
29 lines
783 B
JavaScript
/**
|
|
* Example migration — demonstrates the shape.
|
|
* This one is a NO-OP so the tooling can boot cleanly without
|
|
* interfering with the existing baseline in src/db/database.js.
|
|
*
|
|
* For a real change, replace the body with:
|
|
* exports.up = (pgm) => {
|
|
* pgm.addColumn('users', {
|
|
* avatar_url: { type: 'text' }
|
|
* });
|
|
* };
|
|
* exports.down = (pgm) => {
|
|
* pgm.dropColumn('users', 'avatar_url');
|
|
* };
|
|
*
|
|
* Full API: https://salsita.github.io/node-pg-migrate/
|
|
*/
|
|
|
|
exports.up = async () => {
|
|
// intentionally empty
|
|
};
|
|
|
|
exports.down = async () => {
|
|
// intentionally empty
|
|
};
|
|
|
|
// Tell node-pg-migrate this migration doesn't need a transaction —
|
|
// lets future migrations that need CREATE INDEX CONCURRENTLY etc run.
|
|
exports.shorthands = undefined;
|