# flexgres

> Flexibly change your Postgres schemas with Flexgres.

Latest version **0.2.2** (published 2016-03-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install flexgres
pnpm add flexgres
yarn add flexgres
bun add flexgres
```

## 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.2.2 |
| Published | 2016-03-05 |
| First published | 2016-03-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Chris Cates |
| Maintainers | chriscates |
| Keywords | Chris, Cates, Flexgres, Flexible, Postgres |

## Links

- npm: https://www.npmjs.com/package/flexgres
- Repository: https://github.com/ChrisCates/flexgres
- Homepage: https://github.com/ChrisCates/flexgres#readme
- Issues: https://github.com/ChrisCates/flexgres/issues
- npm.io page: https://npm.io/package/flexgres

## Dependencies (1)

- [async](https://npm.io/package/async.md) ^1.5.2

## Recent versions

- 0.2.2 (latest) — 2016-03-05
- 0.2.1 — 2016-03-02
- 0.2.0 — 2016-03-02
- 0.1.2 — 2016-03-01
- 0.1.1 — 2016-03-01
- 0.1.0 — 2016-03-01

## README

# flexgres
## Flexibly change your Postgres schemas with Flexgres
### By Chris Cates :star:
### Email hello@chriscates.ca :mailbox:

### Installation
```
npm install flexgres --save
```

### Usage
You will need to use the `pg` driver.
You can install it by writing:

```
npm install pg --save
```

Configuring your table is really simple all you have to do is define your table structure in JSON.
An example usage is:

```
var name = "chris", password = "12345", host = "localhost", port = "5432", db = "flexgres";

var pg        = require("pg");
var queryConn = "postgres://"+name+":"+password+"@"+host+":"+port+"/"+db+"";

    client    = new pg.Client(queryConn);

require("flexgres")({
  "driver": client,
  "logging": true,
  "tables": [
    {
      "tableName": "test",
      "columns": [
        {
        "name": "id",
        "type": "INT",
        "primary": true,
        "null": false
        },
        {
        "name": "name",
        "type": "text",
        "primary": true,
        "null": false
        }
      ]
    },
    {
      "tableName": "testTable",
      "columns": [
        {
        "name": "test",
        "type": "INT",
        "primary": true,
        "null": false
        },
        {
        "name": "test2",
        "type": "text",
        "primary": false,
        "null": false
        }
      ]
    }
  ]
})
```

So pretty much there are three JSON key values:

1. driver: this is the `pg` object with query connection string.
2. logging: enable this is if you want to keep track of the SQL queries executed on your database.
3. tables: This is an array of the tables in your JSON object. See above demo to see how to structure
your tables.

### Questions email :mailbox: hello@chriscates.ca

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