Questions tagged [node-pg-migrate]

11 questions
3
votes
2 answers

Run Postgres migration with Docker/Docker compose

I am pretty new to this whole subject, so excuse me if those are silly questions. I want to run unit tests in Docker containers like so: Start up a Postgres container with no tables/data Run the DB migration (I am using node-pg-migrate) to create…
3
votes
2 answers

How do I insert records in a node-pg-migrate migration?

I'm trying to use node-pg-migrate to handle migrations for an ExpressJS app. I can translate most of the SQL dump into pgm.func() type calls, but I can't see any method for handling actual INSERT statements for initial data in my solution's lookup…
Dycey
  • 4,767
  • 5
  • 47
  • 86
2
votes
1 answer

How to define "INT GENERATED ALWAYS AS IDENTITY" column with node-pg-migrate?

How do I define a migration file using node-pg-migrate for the below table CREATE TABLE color ( color_id INT GENERATED ALWAYS AS IDENTITY, color_name VARCHAR NOT NULL ); There seems to be no documentation on how to do INT GENERATED ALWAYS…
PirateApp
  • 5,433
  • 4
  • 57
  • 90
1
vote
1 answer

node-pg-migrate doesn't use config.json file

I'm passing the --config-file flag but it just wont read the thing, do I really need to install a package for something as simple as reading a configuration file? am I doing something wrong?, I run it like so : npm run migrate up --config-file…
1
vote
2 answers

node-pg-migration not reading .env file despite having dotenv installed

I am using node-pg-migrate and would like the db name, password and schema to come from the .env file as opposed to a config file. The .env file is not being used as using the default database. Could you let me know how to get the .env file to be…
0
votes
0 answers

Can node-pg-migrate target a specific schema?

I have a node.js project which uses node-pg-migrate to manage the database in the public schema. I have a second project, and want to use node-pg-migrate to manage an additional schema within the same database. Is it possible to target…
MG123
  • 402
  • 2
  • 14
0
votes
1 answer

How to specify the migration folder path in node-pg-migrate?

I'm using the package node-pg-migrate to control my migrations, but i can't specify the folder i want to create the migration file in CLI. When i run node-pg-migrate create my first migration --migration-dir .\src\infra\db\config\pg\migrations\ i…
Vrrl
  • 27
  • 3
0
votes
0 answers

How do I run a PostgreSQL container using docker-compose with startup files that depends on .env values, then running node-pg-migrate?

I want the following flow. PostgreSQL runs startup script with the values from .env file PostgreSQL runs successfully App runs successfully Run migration commands. I have already created the scripts for migration commands. This is done using…
Richard
  • 7,037
  • 2
  • 23
  • 76
0
votes
1 answer

ENOENT error with child_process spawn referencing a plaintext file meant to run node

I'm trying to recreate the migrate function in this codebase: https://codesandbox.io/s/e9fykv?file=/migrations/migrate.ts. The relevant files in that codebase, for this question, are the following: "migrate.ts" and "node-pg-migrate" in the…
mpr4583
  • 1
  • 1
0
votes
1 answer

pg_try_advisory_lock and pg_advisory_unlock always return false

I have a node.js app that uses PostgreSQL as a database. When I try to run a migration file (using node-pg-migrate package), I keep getting an error: Another migration is already running. Below is the piece of source code of the package that's…
Denis Yakovenko
  • 3,241
  • 6
  • 48
  • 82
0
votes
1 answer

Fails with preceeding/existing migrations

When creating a second migration and attempting to migrate up to add it, the task fails because the first migration was already run. It seems to be running (and failing) rather than skipping previously successful/complete migrations. I have tried…