# psql-dump-handler

> PostgreSQL dump handler

Latest version **0.1.2** (published 2016-07-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install psql-dump-handler
pnpm add psql-dump-handler
yarn add psql-dump-handler
bun add psql-dump-handler
```

Provides the command `psqlDumpHandler`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2016-07-13 |
| First published | 2016-07-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Mak Jacobsen |
| Maintainers | mak1986 |

## Links

- npm: https://www.npmjs.com/package/psql-dump-handler
- Repository: https://github.com/mak1986/psql-dump-handler
- Homepage: https://github.com/mak1986/psql-dump-handler#readme
- Issues: https://github.com/mak1986/psql-dump-handler/issues
- npm.io page: https://npm.io/package/psql-dump-handler

## Dependencies (1)

- [minimist](https://npm.io/package/minimist.md) ^1.2.0

## Recent versions

- 0.1.2 (latest) — 2016-07-13
- 0.1.1 — 2016-07-10
- 0.1.0 — 2016-07-10
- 0.0.2 — 2016-07-10

## README

# psql-dump-handler

[![Build Status](https://travis-ci.org/mak1986/psql-dump-handler.svg?branch=master)](https://travis-ci.org/mak1986/psql-dump-handler)
[![NPM version](http://img.shields.io/npm/v/psql-dump-handler.svg)](https://www.npmjs.org/package/psql-dump-handler)
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/mak1986/psql-dump-handler/blob/master/LICENSE)

## Installation ##

```bash
npm install psql-dump-handler -g
```

## Name ##

	psqlDumpHandler - PostgreSQL dump handler


## Synopsis ##

	psqlDumpHandler [COMMAND] [DATABASE NAME] [OPTIONS]... 

## Description ##

	[COMMAND]: 
		dump (make a dump with only insert statements)

	[DATABASE NAME]
		databaseName, -d databaseName, --database=databaseName 

	[OPTIONS]: 
		-s, --sort (sort the statements by id ascending)


After running the command in the terminal a dump.sql file will be created at your current path..


__NOTE:__ 
```
	1. This module expect you to have "node" command in /usr/bin/node.
	2. This module currently only supports sorting dump file from PostgreSQL. 
```



## Why? ##

When the database dump your data, it might be unsorted just like the example below.

```sql
--
-- PostgreSQL database dump
--

-- Dumped from database version 9.5.1
-- Dumped by pg_dump version 9.5.3

SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET row_security = off;

SET search_path = public, pg_catalog;

--
-- Data for Name: group; Type: TABLE DATA; Schema: public; Owner: makjacobsen
--

INSERT INTO "group" (id, name) VALUES (2, "Admin");
INSERT INTO "group" (id, name) VALUES (1, "Super Admin");


--
-- Name: group_id_seq; Type: SEQUENCE SET; Schema: public; Owner: makjacobsen
--

SELECT pg_catalog.setval('group_id_seq', 2, true);


```

When you use -s option you will get:


```sql
--
-- PostgreSQL database dump
--

-- Dumped from database version 9.5.1
-- Dumped by pg_dump version 9.5.3

SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET row_security = off;

SET search_path = public, pg_catalog;

--
-- Data for Name: group; Type: TABLE DATA; Schema: public; Owner: makjacobsen
--

INSERT INTO "group" (id, name) VALUES (1, "Super Admin");
INSERT INTO "group" (id, name) VALUES (2, "Admin");


--
-- Name: group_id_seq; Type: SEQUENCE SET; Schema: public; Owner: makjacobsen
--

SELECT pg_catalog.setval('group_id_seq', 2, true);


```

## License ##

MIT

---
_Source: https://npm.io/package/psql-dump-handler · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
