migrate

package
v0.50.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2021 License: BSD-3-Clause Imports: 18 Imported by: 1

Documentation

Index

Constants

View Source
const MinCompatibleRelease = "0.46.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 ArtifactoryIntegration

func ArtifactoryIntegration(ctx context.Context, dbFunc func() *gorp.DbMap) error

func AuthConsumerTokenExpiration

func AuthConsumerTokenExpiration(ctx context.Context, dbFunc func() *gorp.DbMap, duration time.Duration) error

func CountSecret

func CountSecret(db gorp.SqlExecutor, id int64) (int64, error)

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 LoadLastRunsByDate

func LoadLastRunsByDate(db gorp.SqlExecutor) ([]sdk.WorkflowRun, error)

LoadLastRuns returns the last run per last_mdodified

func Run

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

Run run all local migrations

func RunsSecrets

func RunsSecrets(ctx context.Context, dbFunc func() *gorp.DbMap) error

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 WorkflowRun

type WorkflowRun struct {
	ID        int64        `json:"id" db:"id"`
	ProjectID int64        `json:"project_id,omitempty" db:"project_id"`
	Workflow  sdk.Workflow `json:"workflow" db:"workflow"`
}

WorkflowRun is an execution instance of a run

Jump to

Keyboard shortcuts

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