pediatric-ai-scribe-v3/migrations/1744600000000_example-no-op.js
Daniel 64ac4ff6bb Add node-pg-migrate for versioned schema changes + better mobile UA labels
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.
2026-04-14 05:06:19 +02:00

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;