Allow users to override initial migration to fix bundling issues #99
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a PR to work around this issue related to bundling: #79
There are several ways to fix the this but I believe this is the least invasive way.
I added instructions for how to use this workaround i in the README as well:
Bundling postgres-migrations
If you are bundling this package with for example Vite/Rollup, you might get the error
ReferenceError: __dirname is not defined
when trying to run migrations.To work around this, you need to:
0_create-migrations-table.sql
The library will then detect the presence of the file and skip including the initial migration from inside the package using
__dirname
. To make sure you copied the file correctly, verify that thehash
for thecreate-migrations-table
migration in themigrations
table ise18db593bcde2aca2a408c4d1100f6abba2195df
.See this issue for additional details.