Skip to content

vitanovs/versioner

Repository files navigation

Versioner

go-doc go-report license

versioner-logo

PostgreSQL schema versioning tool.

Requirements

Installation

In order to install versioner, follow these steps after cloning the repository.

make install

To uninstall the binary, run

make uninstall

The versioner binary will be installed in your $GOPATH/bin directory.

Usage

The versioner CLI tool provides comprehensive menu where all commands and options can be reviewed. To show the help menu, run

versioner --help

To print the menus of the sub commands use:

versioner [options] <command> [options] <sub-command> --help

Autocompletion

Enabling the autocompletion capabilities happens by exposing PROG environment variable and sourcing dedicated completion script, located in autocompletion/ directory of the project.

  • BASH

    PROG=./bin/versioner source ./autocomplete/bash_autocomplete
  • ZSH

    PROG=./bin/versioner _CLI_ZSH_AUTOCOMPLETE_HACK=1 source ./autocomplete/zsh_autocomplete

For more detailed overview of the autocompletion scripts see the official documentation.

Docker

The versioner tool can also be generated as a Docker image. To build image use

make docker

Docker Image Usage

The following is an example of how to use the versioner Docker image to run its commands

docker run --rm versioner --help

Use the following template to create new database:

docker run --rm versioner \
--endpoint <remote> \
--port <remote-port> \
--database <database> \
--username <username-credential> \
--password <password-credential> \
--sslmode <postgres-ssl-mode> \
database create \
--name <database-name>

To remove already existing database, replace create with drop. In case your Postgres server runs on localhost and your OS of choice is macOS or Windows, replace <remote> with:

  • docker.for.mac.localhost for macOS
  • docker.for.win.localhost for Windows

Docker Requirements

docker pull golang:1.13.0
docker pull busybox:1.31.1

Contact

Direct questions or issue to stoyan.a.vitanov@gmail.com or open GitHub issue right away.

License

Copyright © 2020 Versioner