migrator

package
v2.0.0-...-1c13370 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

README

Migrator

Migrator is an utility for schema management in microservices, which based on github.com/golang-migrate/migrate and extended as an cli command using github.com/spf13/cobra

Given a cluster on which migration has to be managed - base engine has to be extended to enable execute of the supported commands.

Usage

migration-client [flags] [command]

migration-client -c mysvcPG up -v 201903290057
Flag

-c or --cluster : cluster identifier on which migration has to be performed -v or --version : version of the migration

Commands
  • up : Applies all migration from current version of migration. If input version is specificed via version flag - applies migrations from current version until given version where given version should be greater than current.
  • down : Applies migration from current version to input version specified via version flag. Here input version should lesser than current version
  • force : Marks the version as applied without running any migration
  • version : displays the current version of migration and its status - which signifies if the current version is applied successfully or not

Extending

Please refer sample implementaion that extended migratorcmdbase.go in example/migratorexample.go

Note: vendor drivers from golang-migrate/migrate based on your requirement of dbType i.e postgres, cassandra, mysql etc,.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute(migrationClientFunc MigrationClientFunc)

Types

type MigrationClientFunc

type MigrationClientFunc func(cluster string) (*migrate.Migrate, error)

Initialize the Migrate with driver based on cluster

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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