migrate

package
v0.53.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2023 License: BSD-3-Clause Imports: 15 Imported by: 1

Documentation

Index

Constants

View Source
const MinCompatibleRelease = "0.52.0"

MinCompatibleRelease represent the minimum release which is working with these migrations, need to update when we delete migration in our codebase

Variables

This section is empty.

Functions

func Add

func Add(ctx context.Context, migration sdk.Migration)

Add adds a migration to the list of migrations to run at API start time example of usage:

migrate.Add(sdk.Migration{Name: "MyMigration", Release: "0.39.3", Mandatory: true, ExecFunc: func(ctx context.Context) error {
	return migrate.MyMigration(ctx, a.Cache, a.DBConnectionFactory.GetDBMap)
}})

func Delete

func Delete(db gorp.SqlExecutor, mig *sdk.Migration) error

Delete migration in database.

func GetAll

func GetAll(db gorp.SqlExecutor) ([]sdk.Migration, error)

GetAll returns the migration for given name.

func GetByName

func GetByName(db gorp.SqlExecutor, name string) (*sdk.Migration, error)

GetByName returns the migration for given name.

func Insert

func Insert(db gorp.SqlExecutor, mig *sdk.Migration) error

Insert migration in database.

func MigrateConsumers added in v0.53.0

func MigrateConsumers(ctx context.Context, db *gorp.DbMap, c cache.Store) error

func Run

func Run(ctx context.Context, db gorp.SqlExecutor)

Run run all local migrations

func SaveAllMigrations

func SaveAllMigrations(db gorp.SqlExecutor) error

SaveAllMigrations save all local migrations marked to "done" into database (in case of a fresh installation)

func Status

Status returns monitoring status, if there are cds migration in progress it returns WARN

func Update

func Update(db gorp.SqlExecutor, mig *sdk.Migration) error

Update migration in database.

func UpdateStatus

func UpdateStatus(db gorp.SqlExecutor, id int64, status string) error

UpdateStatus update the status of a migration given its id

Types

type UserOrganizationMigrate added in v0.53.0

type UserOrganizationMigrate struct {
	User             *sdk.AuthentifiedUser
	OrganizationName string
}

func GetOrganizationUsersToMigrate added in v0.53.0

func GetOrganizationUsersToMigrate(ctx context.Context, db *gorp.DbMap) ([]UserOrganizationMigrate, error)

Jump to

Keyboard shortcuts

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