dbmagritte

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

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

Go to latest
Published: Jan 31, 2022 License: MIT Imports: 10 Imported by: 0

README

dbmagritte

created by Austin Poor

A database migration tool written in Go.

Motivation

I created this project as a bit of a playground so I could get a sense of the chalanges involved in creating a DB migration tool. I don't plan to maintain or even necessarily finish this tool.

Any suggestions and comments are welcome!

Usage

Commands:

  • init: Set up the repo by creating a .dbmagritte.yaml file and a migrations/ directory.

  • new: Create a new migration.

  • info: Get the current state of the DB.

  • validate: Check if the DB is in a valid state? Optional validate.sql file?

  • up: Move forward in the migration tree.

  • down: Move back in the migration tree.

  • reset: Roll-back all migrations

  • fast-forward: Move to the newest migration (assuming there's just one)

Notes

new creates a new directory in the migrations/ directory named after the current git hash.

The directory needs to have an up.sql (to make a migration) and a down.sql (to undo the migration). It can also, optionally, have a validate.sql file to check if the DB is in a valid state.

Q: Should there be a config file in each directory? That way there can be multiple up/down/validate SQL files per migration. They will be run in order. Might solve issues of validating with multiple SQL statements in one file?

Create global flags to set the path to the project root, so it can be run from somewhere else.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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