godfish

command module
v0.0.0-...-a6d4a70 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2019 License: ISC Imports: 8 Imported by: 0

README

godfish

GoDoc

godfish is a relational database migration manager. It's similar to the very good dogfish, but written in golang.

It's been tested w/ golang v1.12 on linux systems.

goals

  • use SQL in the migration files, no other high-level DSLs
  • interface with many RDBMSs
  • as little dependencies outside of the standard library as possible
  • not terrible error messages

installation

go install bitbucket.org/rafaelespinoza/godfish

or for development

go get bitbucket.org/rafaelespinoza/godfish
cd "$GOPATH/bitbucket.org/rafaelespinoza/godfish"
make install

usage

godfish help
godfish -h
godfish <command> -h

Make your life easier by creating a configuration file.

godfish init

Configuration options are read from command line flags first. If those are not set, then it checks the configuration file.

Database connection parameters are always read from environment variables. The ones to set are:

DB_HOST=
DB_NAME=
DB_PASSWORD=
DB_PORT=
DB_USER=

other minutiae

Here are some notable differences between dogfish and godfish:

Filenames:

  • dogfish: migrate-${date}-${name}.sql, or rollback-${date}-${name}.sql
  • godfish: forward-${date}-${name}.sql, or reverse-${date}-${name}.sql

Note, dogfish uses the words, "migrate" and "rollback" to describe the migration's direction whereas godfish uses "forward" and "reverse". They are the same in that they are two complementaries. This change has one trivial benefit, the pieces of metadata encoded into the filename naturally align:

cd /path/to/db/migrations && ls -1

forward-20191112050547-init_foos.sql
forward-20191127051242-add_bars.sql
forward-20191205031405-update_more_stuff.sql
reverse-20191112050547-init_foos.sql
reverse-20191127051242-add_bars.sql
reverse-20191205031405-update_more_stuff.sql

contributing

These are welcome. To get you started, the code has some documentation, a godoc page, at least one implementation of each interface and tests. gofmt or gtfo. Comments line lengths should be limited to 80 characters wide. Try not to make source code lines too long. More lines is fine with the exception of declarations of exported identifiers; they should be on one line, otherwise the generated godoc looks weird. There are also tests, those should pass.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package godfish is a database migration library built to support a CLI tool, also called godfish.
Package godfish is a database migration library built to support a CLI tool, also called godfish.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL