Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage of globs (flag use-glob true) is ignored when set in config file #1279

Closed
alexander-hoermandinger-ded opened this issue Oct 3, 2024 · 0 comments · Fixed by #1282
Closed
Labels
s: pending triage Pending Triage

Comments

@alexander-hoermandinger-ded
Copy link

alexander-hoermandinger-ded commented Oct 3, 2024

Describe the bug

The (great!) feature to support using globs for configuring ignorePatterns and migrationDir was introduced recently: PR1274
That feature works great when specifying --use-glob true via command line but the flag is ignored when setting it via config file.

The reason is that code is missing in function node-pg-migrate.ts:readJson to apply the flag if found in the config file:
readJson

Steps to reproduce

  • Create config file with:
    use-glob: true
    migrations-dir: migrations/**

  • Trigger migration up

  • Expected result: Migration works

  • Actual result: Error: Can't get migration files: Error: ENOENT: no such file or directory, scandir 'migrations/dev/*.ts/'
    at async readdir (node:internal/fs/promises:948:18)
    at async getMigrationFilePaths (/home/axjrd/git-repos/docbot/docbot/docbot/node_modules/node-pg-migrate/dist/migration.js:79:22)

Logs

Error: Can't get migration files: Error: ENOENT: no such file or directory, scandir 'migrations/dev/*.ts/'
at async readdir (node:internal/fs/promises:948:18)
at async getMigrationFilePaths (/home/axjrd/git-repos/docbot/docbot/docbot/node_modules/node-pg-migrate/dist/migration.js:79:22)
at async loadMigrations (/home/axjrd/git-repos/docbot/docbot/docbot/node_modules/node-pg-migrate/dist/runner.js:48:31)
at async Promise.all (index 0)
at async runner (/home/axjrd/git-repos/docbot/docbot/docbot/node_modules/node-pg-migrate/dist/runner.js:233:36)
at loadMigrations (/home/axjrd/git-repos/docbot/docbot/docbot/node_modules/node-pg-migrate/dist/runner.js:71:11)
at async Promise.all (index 0)
at async runner (/home/axjrd/git-repos/docbot/docbot/docbot/node_modules/node-pg-migrate/dist/runner.js:233:36)

System Info

Node 20

Used Module System

cjs

benkroeger added a commit to benkroeger/node-pg-migrate that referenced this issue Oct 8, 2024
fixes salsita#1279

Signed-off-by: Benjamin Kroeger <benjamin.kroeger@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s: pending triage Pending Triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant