migrable

command module
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: MIT Imports: 3 Imported by: 0

README

migrable

Declarative config file migrations for TOML.

Features

  • 14 migration ops covering structure, data, and raw edits
  • Comment-preserving TOML editing via go-toml-edit
  • Rollback via down ops
  • Multi-file transactional writes
  • CEL expressions for transforms
  • Dry-run preview
  • Conformance test suite

Install

go install github.com/smm-h/migrable@latest

Or download binaries from GitHub Releases.

npm and PyPI wrappers coming soon.

Quick start

  1. Scaffold a new project:
migrable init

This creates migrable.toml and a migrations/ directory.

  1. Edit migrable.toml to point to your config file:
migrations_dir = "migrations"

[files]
config = "config.toml"
  1. Create a migration file migrations/0001_add-debug.toml:
description = "add debug flag to server section"

[[structure]]
op = "add_field"
path = "server.debug"
type = "boolean"
default = false
down = { op = "remove_field", path = "server.debug" }
  1. Apply pending migrations:
migrable migrate
  1. Preview changes without writing:
migrable migrate --dry-run
  1. Reverse the last migration:
migrable migrate --rollback

Library usage

Go projects can import the engine directly:

import (
    "github.com/smm-h/migrable/config"
    "github.com/smm-h/migrable/engine"
)

cfg, _ := config.Load("")
result, _ := engine.Migrate(cfg, false)

CLI reference

Command Description
migrable migrate Run pending migrations
migrable migrate --dry-run Preview changes
migrable migrate --rollback Reverse last migration
migrable status Show version and pending migrations
migrable validate Check migration files
migrable merge <version> Combine staging files
migrable init Scaffold new project

Shell completions

migrable completion bash > /etc/bash_completion.d/migrable
migrable completion zsh > "${fpath[1]}/_migrable"
migrable completion fish > ~/.config/fish/completions/migrable.fish

License

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
cel
Package cel integrates CEL expression evaluation for transform ops.
Package cel integrates CEL expression evaluation for transform ops.
cli
Package ops implements the 14 migration operations.
Package ops implements the 14 migration operations.

Jump to

Keyboard shortcuts

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