salsita / node-pg-migrate

Node.js database migration management for PostgreSQL
https://salsita.github.io/node-pg-migrate
MIT License
1.28k stars 176 forks source link

Check for required property migrationsTable of RunnerOption #1227

Open weslord opened 2 months ago

weslord commented 2 months ago

Description

Discovered that migrationsTable was actually a required property when converting some JavaScript files to TypeScript.

I had been calling runner() without providing migrationsTable and it seemed to work fine:

await runner({
    dbClient: dbClient,
    dir: 'db/migrations',
    direction: 'up',
  })

Behind the scenes I expected it was using the default value of "pgmigrations", same as the CLI.

It was actually coercing the missing value to a string and creating a migrations table named "undefined". Probably not harmful (it certainly wasn't in my case), but a little surprising. Feels more like an unexpected side-effect than a deliberate choice.

Suggested solution

Either

Alternative

No response

Additional context

No response