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

Allow to skip the default migration creating the migrations table #94

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

meienberger
Copy link

Context

I'm working with esbuild as my bundler to include all dependencies in one .js bundle file. This makes it possible to ship my app with only the necessary dependencies included and to skip node_modules all together.

Problem

When bundling, the code of postgres-migrations is correctly included but the default behaviour is to use the file 0_create-migrations-table.sql which is not bundled as it is not used in my project directly. Thus giving the error :

Error: ENOENT: no such file or directory, open 'migrations/0_create-migrations-table.sql' - Offending file: '0_create-migrations-table.sql'.

Because the file doesn't exist from my bundled code.

Solution

This PR adds a simple config param skipCreateMigrationTable to avoid using the default init table. This way I can create it myself in the migrations folder of my project

Example

await migrate({ client }, path.join(__dirname, 'migrations'), { skipCreateMigrationTable: true });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant