-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmigration_helper.go
37 lines (31 loc) · 1.22 KB
/
migration_helper.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package anser
import (
"context"
"github.com/cdr/amboy/job"
"github.com/deciduosity/anser/model"
)
// MigrationHelper is an interface embedded in all jobs as an
// "extended base" for migrations on top of the existing amboy.Base
// type which implements most job functionality.
//
// MigrationHelper implementations should not require construction:
// getter methods should initialize nil values at runtime.
type MigrationHelper interface {
Env() Environment
// Migrations need to record their state to help resolve
// dependencies to the database.
FinishMigration(context.Context, string, *job.Base)
SaveMigrationEvent(context.Context, *model.MigrationMetadata) error
// The migration helper provides a model/interface for
// interacting with the database to check the state of a
// migration operation, helpful in dependency approval.
PendingMigrationOperations(context.Context, model.Namespace, map[string]interface{}) int
GetMigrationEvents(context.Context, map[string]interface{}) MigrationMetadataIterator
}
// MigrationMetadataiterator wraps a query response for data about a migration.
type MigrationMetadataIterator interface {
Next(context.Context) bool
Item() *model.MigrationMetadata
Err() error
Close() error
}