@mmckelvy/run-pg-script

1.0.1 • Public • Published

run-pg-script

Run Postgres scripts using psql the right way.

Applies the appropriate options for running scripts through psql.

Installation

npm install @mmckelvy/run-pg-script

Usage

const runPgScript = require('run-pg-script');

runPgScript({
  dbName: 'my-db',
  file: `${__dirname}/schema/base-schema.sql`)
});

Default options

Runs your scripts using the following psql options:

--no-psqlrc: No need for custom formatting if you're just running a script.

--set ON_ERROR_STOP=1: Stop the script if there's an error.

--pset pager=off: No need for a pager when we're running a script.

--single-transaction: Run the script as a single transaction.

Readme

Keywords

Package Sidebar

Install

npm i @mmckelvy/run-pg-script

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

3.11 kB

Total Files

4

Last publish

Collaborators

  • mmckelvy