migrations

package
v3.16.3 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

All is a list of all database migrations.

Functions

func Apply

func Apply(ctx context.Context, transact func(context.Context, func(*gorm.DB) error) error, migrations ...Migration) error

Apply applies the list of migrations on the database connection.

Types

type Migration

type Migration interface {
	// Name returns the name of the migration.
	Name() string
	// Apply applies the changes imposed by the migration to the given database (or transaction).
	Apply(context.Context, *gorm.DB) error
	// Rollback rolls back the changes imposed by the migration to the given database (or transaction).
	Rollback(context.Context, *gorm.DB) error
}

Migration abstracts away the logic of a migration.

Jump to

Keyboard shortcuts

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