# mythix-orm-postgresql

> PostgreSQL driver for Mythix ORM

Latest version **1.13.0** (published 2026-02-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install mythix-orm-postgresql
pnpm add mythix-orm-postgresql
yarn add mythix-orm-postgresql
bun add mythix-orm-postgresql
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 1.13.0 |
| Published | 2026-02-23 |
| First published | 2022-08-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=18.0.0 |
| Dependencies | 5 |
| Unpacked size | 216.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Wyatt Greenway |
| Maintainers | th317erd |
| Keywords | orm, mysql, postgres, postgresql, mssql, mongo, snowflake, database, sql, no-sql |

## Links

- npm: https://www.npmjs.com/package/mythix-orm-postgresql
- Repository: https://github.com/th317erd/mythix-orm-postgresql
- Homepage: https://github.com/th317erd/mythix-orm-postgresql#readme
- Issues: https://github.com/th317erd/mythix-orm-postgresql/issues
- npm.io page: https://npm.io/package/mythix-orm-postgresql

## Dependencies (5)

- [pg](https://npm.io/package/pg.md) ^8.16.0
- [nife](https://npm.io/package/nife.md) ^1.12.1
- [uuid](https://npm.io/package/uuid.md) ^11.1.0
- [luxon](https://npm.io/package/luxon.md) ^3.7.2
- [pg-format](https://npm.io/package/pg-format.md) ^1.0.4

## Alternatives

- [angular-pipes](https://npm.io/package/angular-pipes.md) — 5.6K weekly downloads
- [@ng-web-apis/midi](https://npm.io/package/@ng-web-apis/midi.md) — 2.6K weekly downloads
- [happn-3](https://npm.io/package/happn-3.md) — 1.6K weekly downloads
- [@opensip-cli/lang-go](https://npm.io/package/@opensip-cli/lang-go.md) — 1.2K weekly downloads
- [mongoose-typescript](https://npm.io/package/mongoose-typescript.md) — 85 weekly downloads

## Recent versions

- 1.13.0 (latest) — 2026-02-23
- 1.12.1 — 2023-06-10
- 1.12.0 — 2023-01-09
- 1.11.3 — 2022-12-14
- 1.11.2 — 2022-12-14
- 1.11.1 — 2022-12-14
- 1.11.0 — 2022-12-13
- 1.10.1 — 2022-12-13
- 1.10.0 — 2022-12-01
- 1.9.6 — 2022-11-29
- 1.9.5 — 2022-11-23
- 1.9.4 — 2022-11-23
- 1.9.3 — 2022-11-23
- 1.9.2 — 2022-11-22
- 1.9.1 — 2022-11-22
- … 39 more at https://npm.io/package/mythix-orm-postgresql/versions

## README

# mythix-orm-postgresql

![Mythix](docs/mythix-logo-colored.png)

PostgreSQL database driver for [Mythix ORM](https://www.npmjs.com/package/mythix-orm).

## Install

```bash
npm i --save mythix-orm-postgresql
```

## Documentation

Documentation can be found at the [WIKI](https://github.com/th317erd/mythix-orm-postgresql/wiki).

Documentation for Mythix ORM can be found at the [Mythix ORM WIKI](https://github.com/th317erd/mythix-orm/wiki).

## Usage

```javascript
const { PostgreSQLConnection } = require('mythix-orm-postgresql');

(async function() {
  let connection = new PostgreSQLConnection({
    bindModels: true,
    models:     [ /* application models */ ],
    logger:     console,
    user:       'database-username',
    password:   'database-password',
    database:   'test-database',
    host:       '127.0.0.1',
    port:       5432,
  });

  await connection.start();

  // run application code

  await connection.stop();
})();
```

## Connection Options

| Option | Type | Default Value | Description |
| ------ | ---- | ------------- | ----------- |
| `bindModels` | `boolean` | `true` | Bind the models provided to this connection (see the Mythix ORM [Connection Binding](https://github.com/th317erd/mythix-orm/wiki/ConnectionBinding) article for more information). |
| `connectionTimeout` | `number` | `60000` | Number of milliseconds to wait for connection. |
| `host` | `string` | `undefined` | The domain/host used to connect to the database. |
| `idleTransactionTimeout` | `number` | `undefined` | Number of milliseconds before terminating any session with an open idle transaction. |
| `logger` | Logger Interface | `undefined` | Assign a logger to the connection. If a logger is assigned, then every query (and every error) will be logged using this logger. |
| `maxPoolConnections` | `number` | `10` | Maximum number of clients the connection pool should contain. |
| `models` | `Array<Model>` | `undefined` | Models to register with the connection (these models will be bound to the connection if the `boundModels` option is `true`).
| `password` | `string` | `undefined` | The password used to connect to the database. |
| `port` | `string` | `5432` | The port used to connect to the database. |
| `queryGenerator` | [QueryGenerator](https://github.com/th317erd/mythix-orm/wiki/QueryGeneratorBase) | <see>PostgreSQLQueryGenerator</see> | Provide an alternate `QueryGenerator` interface for generating SQL statements for PostgreSQL. This is not usually needed, as the `SQLiteConnection` itself will provide its own generator interface. However, if you want to customize the default query generator, or want to provide your own, you can do so using this option. |
| `queryTimeout` | `number` | `15000` | Number of milliseconds before a query call will timeout. |
| `statementTimeout` | `number` | `15000` | Number of milliseconds before a statement in query will time out. |
| `user` | `string` | `undefined` | The username used to connect to the database. |

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