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

Mocking database or in-memory database #928

Closed
jellyninjadev opened this issue Mar 16, 2023 · 3 comments
Closed

Mocking database or in-memory database #928

jellyninjadev opened this issue Mar 16, 2023 · 3 comments
Labels
has workaround Workaround provided or linked

Comments

@jellyninjadev
Copy link

Hello, I was thinking to run my migrations with pg-mem to my Postgres database.
Is there a way for me to do that?

@pkit
Copy link

pkit commented Aug 19, 2023

What's the problem with using a disposable docker image?

@ambita-hme
Copy link

ambita-hme commented Aug 25, 2023

pg-mem supports migrations with node-pg-migrate format numbering format since the file prefix is sequential.
If you store the migrations in a /migrations folder in the root of your project you can just call.
await db.public.migrate();

Or specify the path with migrationsPath, i.e
await db.public.migrate({ migrationsPath: Path.resolve(__dirname, '../../migrations') });

This is on the pg-mem database object

@Shinigami92 Shinigami92 added the has workaround Workaround provided or linked label May 2, 2024
@Shinigami92
Copy link
Collaborator

If I understand @ambita-hme's comment correctly, this is a (workaround) solution.
I think there is no error with using pg-mem or a real postgres docker container
node-pg-migrate just generates the SQL statements and sends them via pg-connection to the DB instance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has workaround Workaround provided or linked
Projects
None yet
Development

No branches or pull requests

4 participants