I would like to improve my fellow devs experience by giving them a warning if their database is outdated. Quite often it happens that you pull in the latest branch from source control and forget to reapply migrations for your local environment, and usually this won't present itself clearly as an outdated database issue, but the app misbehaving in some odd way.
To this end, I think it could be useful if there was some exposed function for simply listing the migrations that have not yet been applied.
import { pendingMigrations } from "postgres-migrations";
const migrations = pendingMigrations(client);
if (migrations.length > 0) {
log.fatal(`Psst ${process.env.user}, there are ${migrations.length} migrations that
you haven't applied yet to your database.`)
}
Just a small suggestion, I would understand if you don't want this due to scope creep. I can always just implement this in my own project by copying some code from the library itself.
I would like to improve my fellow devs experience by giving them a warning if their database is outdated. Quite often it happens that you pull in the latest branch from source control and forget to reapply migrations for your local environment, and usually this won't present itself clearly as an outdated database issue, but the app misbehaving in some odd way.
To this end, I think it could be useful if there was some exposed function for simply listing the migrations that have not yet been applied.
Just a small suggestion, I would understand if you don't want this due to scope creep. I can always just implement this in my own project by copying some code from the library itself.