migrations

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractVersionFromFilename

func ExtractVersionFromFilename(filename string) (string, error)

ExtractVersionFromFilename returns the migration version from a filename

func GenerateMigrationVersion

func GenerateMigrationVersion() (*string, error)

GenerateMigrationVersion returns a new timestamp-derived migration version

Types

type IMigration

type IMigration interface {
	Validate() error
	File() *serializers.MigrationFile
	Filename() *string
	SyncPath() string
	Serializable() interface{}
	MigrationVersion() *string
	SameResourceAs(other IMigration) bool
	ApplyToSchema(schema *serializers.Schema, migrationRepo Repository, idempotently bool) error
}

IMigration represents a migration

type Repository

type Repository map[string]IMigration

Repository is a map of migrations indexed by migration version

func (*Repository) SortedVersions

func (m *Repository) SortedVersions() []string

SortedVersions sorts and returns the migration versions in a repo because maps don't preserve order in go

Jump to

Keyboard shortcuts

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