salsita / node-pg-migrate

Node.js database migration management for PostgreSQL

Home Page:https://salsita.github.io/node-pg-migrate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Password with `?` causes "Invalid URL" throw

bmxpiku opened this issue · comments

Hello, apparently when your password is generated with question mark it throws..

await migrate.default({
      // eslint-disable-next-line max-len
      databaseUrl: `postgres://${RDS_USER}:${RDS_PASSWORD}@${RDS_HOST}:${RDS_PORT}/db_name`,
      dir: 'migrations',
      direction: process.env.MIGRATION_DIRECTION || 'up',
      migrationsTable: 'migrations',
      count: process.env.MIGRATE_COUNT || 100,
    });

which produces in my case URL like
postgres://user:pass?word@hosting:5432/db_name
image

Solution is

${encodeURIComponent(RDS_PASSWORD)}