Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shelfio/postgres-local
Run Postgres locally
https://github.com/shelfio/postgres-local
javascript local nodejs postgres postgresql
Last synced: 5 days ago
JSON representation
Run Postgres locally
- Host: GitHub
- URL: https://github.com/shelfio/postgres-local
- Owner: shelfio
- License: mit
- Created: 2022-12-21T20:42:14.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-08-27T13:53:20.000Z (3 months ago)
- Last Synced: 2024-10-01T10:22:33.946Z (about 1 month ago)
- Topics: javascript, local, nodejs, postgres, postgresql
- Language: TypeScript
- Homepage:
- Size: 64.5 KB
- Stars: 4
- Watchers: 3
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# postgres-local [![CircleCI](https://dl.circleci.com/status-badge/img/gh/shelfio/postgres-local/tree/master.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/shelfio/postgres-local/tree/master) ![](https://img.shields.io/badge/code_style-prettier-ff69b4.svg) [![npm (scoped)](https://img.shields.io/npm/v/@shelf/postgres-local.svg)](https://www.npmjs.com/package/@shelf/postgres-local)
> Run any version of Postgres locally
## Usage
### 0. Install
```
$ yarn add @shelf/postgres-local --dev
```### 1. Start Postgres
```js
import {start} from '@shelf/postgres-local';await start({
seedPath: "schema.sql",
version: 14,
port: 5555,
includeInstallation: true,
debugMode: false
});
```
- `seedPath` - absolute path to sql file with commands that will set up db structure before tests
- `includeInstallation`
- when this flag is `true` (default) macOS will run `brew install` and linux `apt install` to make sure `postgres` is installed
- when false - package omit installing postgres and relly that it is already in place
- `debugMode` - used for streaming terminal logs during executing `start` and `stop` methods
### 2. Stop Postgres```js
import {stop} from '@shelf/postgres-local';await stop({version: 14});
```## Publish
```sh
$ git checkout master
$ yarn version
$ yarn publish
$ git push origin master --tags
```## License
MIT © [Shelf](https://shelf.io)