migrations

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package migrations contains code that modifies data in the boltdb database as application logic changes. If a new field is added to a model, there is a good chance there will be an accompanying migration to help facilitate the change. Everything in here is ran in a single transaction, so any errors will rollback all changes made by migrations in this file.

Index

Constants

This section is empty.

Variables

Migrations holds the list of migrations that need to be ran. Version.Version is a count of migrations that have been ran so far and it's used as an index into this slice to find pending migrations.

Functions

func MustMigrate

func MustMigrate(cfg *config.Config)

Types

type CreateInitialPageIndexes

type CreateInitialPageIndexes struct{}

func (CreateInitialPageIndexes) Description

func (CreateInitialPageIndexes) Description() string

func (CreateInitialPageIndexes) Migrate

func (CreateInitialPageIndexes) Migrate(cfg *config.Config, tx *bolt.Tx) error

type MigrateOldDatabase

type MigrateOldDatabase struct{}

func (MigrateOldDatabase) Description

func (MigrateOldDatabase) Description() string

func (MigrateOldDatabase) Migrate

func (MigrateOldDatabase) Migrate(cfg *config.Config, tx *bolt.Tx) error

type Migration

type Migration interface {
	Description() string
	Migrate(cfg *config.Config, tx *bolt.Tx) error
}

Migration is an interface type that represents a single migration action. Types that satisfy this interface can modify data using the transaction passed into it as a parameter.

Jump to

Keyboard shortcuts

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