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 users to override initial migration to fix bundling issues #99

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

Conversation

khromov
Copy link

@khromov khromov commented Feb 5, 2023

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:

  1. Download the initial migration from this link and put it in your migrations folder.
  2. Make sure the name of the file is exactly the same as the original: 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 the hash for the create-migrations-table migration in the migrations table is e18db593bcde2aca2a408c4d1100f6abba2195df.

See this issue for additional details.

@@ -0,0 +1 @@
12
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on my best guess, because the latest Node version gave me big diffs in the package-lock file that I didn't want to include in this PR.

@@ -1,4 +1,5 @@
module.exports = {
extensions: ["ts"],
require: ["ts-node/register"],
timeout: '120s'
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had issues with Docker tests timing out and for some reason ava just marks the tests as OK if it times out. 🤷

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