migrations

package
v2.0.0-alpha.14 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2020 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package migrations implements the migrations subcommand structure.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateMigrationPlan

func GenerateMigrationPlan(
	db *store.Context,
	direction types.Direction,
	migrations *types.Migrations,
) ([]*types.Migration, error)

GenerateMigrationPlan creates a migration plan based on difference with the current state recorded on the database and direction.

Types

type Down

type Down struct {
	Driver interface {
		driver.WithMigrations
		driver.WithSource
	} `json:"driver" yaml:"driver"`
}

Down represents the database migration down command object.

func (Down) Execute

func (r Down) Execute(name string, out io.Writer, args []string) error

Execute runs the command.

func (Down) NewCommand

func (r Down) NewCommand(ctx context.Context, name string) *cobra.Command

NewCommand creates a new cobra.Command, configures it and returns it.

type Generate

type Generate struct {
	Driver interface {
		driver.WithMigrations
		driver.WithSource
	} `json:"driver" yaml:"driver"`
}

Generate represents the generate command which allows for generating new templates of the database migrations file.

func (Generate) Execute

func (r Generate) Execute(name string, out io.Writer, args []string) error

Execute runs the command.

func (Generate) NewCommand

func (r Generate) NewCommand(ctx context.Context, name string) *cobra.Command

NewCommand returns a new cobra.Command generate command object.

type Report

type Report struct {
	Driver interface {
		driver.WithMigrations
		driver.WithSource
	} `json:"driver" yaml:"driver"`
}

Report represents the database migration report command object.

func (Report) Execute

func (r Report) Execute(name string, out io.Writer, args []string) error

Execute runs the command.

func (Report) NewCommand

func (r Report) NewCommand(ctx context.Context, name string) *cobra.Command

NewCommand creates a new cobra.Command, configures it and returns it.

type Up

type Up struct {
	Driver interface {
		driver.WithMigrations
		driver.WithSource
	} `json:"driver" yaml:"driver"`
}

Up represents the database up command object.

func (Up) Execute

func (r Up) Execute(name string, out io.Writer, args []string) error

Execute runs the command.

func (Up) NewCommand

func (r Up) NewCommand(ctx context.Context, name string) *cobra.Command

NewCommand creates a new cobra.Command, configures it and returns it.

Jump to

Keyboard shortcuts

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