migration

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: MIT Imports: 13 Imported by: 0

README

Migration

Commonly used migration tools

Usage
package main

import (
	"context"
	"embed"

	"github.com/infiniteloopcloud/migration"
)

//go:embed files
var Files embed.FS

func main() {
	ctx := context.Background()

	// Library usage
	migration.Get(ctx, "database connection string", Files)

	// Executable usage
	migration.MigrationTool("database connection string", false, Files)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromEmbeds

func FromEmbeds(opts Opts, embeds ...embed.FS) (afero.Fs, error)

func Get

func Get(_ context.Context, conn string, opts Opts, embeds ...embed.FS) (*migrate.Migrate, error)

Get will return the migration prepared for the certain files embedded into the binary

func MigrationTool

func MigrationTool(conn string, down bool, opts Opts, embeds ...embed.FS)

func PreHookMigration added in v0.5.0

func PreHookMigration(params PreHookMigrationParams) func(ctx context.Context)

func PrepareCockroach added in v0.4.0

func PrepareCockroach(conn string) string

Types

type Opts

type Opts struct {
	Path string
}

type PreHookMigrationParams added in v0.5.0

type PreHookMigrationParams struct {
	SkipMigration    string
	ConnectionString string
	PostgresDialect  bool
	Files            []embed.FS
}

Jump to

Keyboard shortcuts

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