https://github.com/prosumma/hs-migrator
A PostgreSQL database migrator
https://github.com/prosumma/hs-migrator
Last synced: 9 months ago
JSON representation
A PostgreSQL database migrator
- Host: GitHub
- URL: https://github.com/prosumma/hs-migrator
- Owner: Prosumma
- License: other
- Created: 2024-12-01T18:54:03.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-02T02:01:58.000Z (about 1 year ago)
- Last Synced: 2025-05-23T04:28:57.722Z (about 1 year ago)
- Language: Haskell
- Size: 34.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Migrator
A low-level, slightly idiosyncratic PostgreSQL migration tool written in Haskell for my personal use.
- It supports PostgreSQL only.
- It supports only "up" migrations, not "down" migrations.
## Installation
```sh
stack build && stack install
```
This installs an executable called `migrate`.
## Usage
For usage, execute `migrate --help`. For usage on any individual command, `migrate --help COMMAND`, e.g., `migrate --help up`.
## Connection
Connection information is not passed with command line arguments, but using the same environment variables used by the `psql` command line tool, e.g., `PGHOST`, `PGDATABASE`, `PGUSER`, etc.
```sh
PGDATABASE=foo PGUSER=bob migrate up --drop --directory migrations
```
The specified user must have the appropriate permissions to perform the migration. What exactly those are depends on the migration and options (such as `--drop`), but in general, a migration should be run by a superuser, since it involves extensive use of DDL.