# pg-auto-write

> Auto-write psql tables using visualization app

Latest version **3.0.0** (published 2021-04-17) · ISC license · 0 weekly downloads

## Install

```sh
npm install pg-auto-write
pnpm add pg-auto-write
yarn add pg-auto-write
bun add pg-auto-write
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2021-04-17 |
| First published | 2020-11-08 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 10.6 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| Author | John Cook |
| Maintainers | jpcook72 |

## Links

- npm: https://www.npmjs.com/package/pg-auto-write
- npm.io page: https://npm.io/package/pg-auto-write

## Dependencies (3)

- [axios](https://npm.io/package/axios.md) ^0.21.0
- [express](https://npm.io/package/express.md) ^4.17.1
- [sequelize](https://npm.io/package/sequelize.md) ^6.3.5

## Recent versions

- 3.0.0 (latest) — 2021-04-17
- 2.5.0 — 2021-01-03
- 2.4.8 — 2021-01-02
- 2.4.7 — 2021-01-02
- 2.4.6 — 2020-12-25
- 2.4.5 — 2020-12-25
- 2.4.4 — 2020-12-25
- 2.4.3 — 2020-12-24
- 2.4.2 — 2020-11-14
- 2.4.1 — 2020-11-14
- 2.4.0 — 2020-11-14
- 2.3.0 — 2020-11-14
- 2.2.0 — 2020-11-12
- 2.1.2 — 2020-11-12
- 2.1.1 — 2020-11-12
- … 12 more at https://npm.io/package/pg-auto-write/versions

## README

pg-auto-write will auto-generate PostgreSQL code for modelling the database.

Go to https://pg-visualizer.herokuapp.com/ and save a database model schema.

pg-auto-write is intended for use with Sequelize. 
pg-auto-write returns a database-syncing function that can be used with your 6-digit schema code to set-up your database instance.

The datsabase-syncing function returns a promise.

Example code to initialize application that uses pg-auto-write:
```
const express = require("express")
const {DBsync} = require('pg-auto-write')
const Sequelize = require('sequelize');

const db = new Sequelize(`postgres://localhost:5432/fake-project`, {
    logging: false,
    });

const app = express();
app.use(express.json());

const init = async() => {
    try {
        await DBsync(db)
        const port = process.env.PORT || 8081;
        app.listen(port, ()=> console.log(`listening on port ${port}`));
    }
    catch(ex){
        console.log(ex);
    }
};

init();
```

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