Documentation ¶
Overview ¶
Package migrate provides simple and flexible CLQ migrations. Migrations can be read from a flat directory containing cql files. There is no imposed naming schema, migration name is file name and the migrations are processed in lexicographical order. Caller provides a gocql.Session, the session must use a desired keyspace as migrate would try to create migrations table.
Index ¶
Constants ¶
const ( AwaitSchemaAgreementDisabled awaitSchemaAgreement = iota AwaitSchemaAgreementBeforeEachFile AwaitSchemaAgreementBeforeEachStatement )
Options for checking schema agreement.
Variables ¶
var DefaultAwaitSchemaAgreement = AwaitSchemaAgreementDisabled
DefaultAwaitSchemaAgreement controls whether checking for cluster schema agreement is disabled or if it is checked before each file or statement is applied. The default is not checking before each file or statement but only once after every migration has been run.
Functions ¶
Types ¶
type CallbackEvent ¶
type CallbackEvent uint8
CallbackEvent specifies type of the event when calling CallbackFunc.
const ( BeforeMigration CallbackEvent = iota AfterMigration )
enumeration of CallbackEvents
type CallbackFunc ¶
type CallbackFunc func(ctx context.Context, session *gocql.Session, ev CallbackEvent, name string) error
CallbackFunc enables interrupting the migration process and executing code while migrating. If error is returned the migration is aborted.
var Callback CallbackFunc
Callback is called before and after each migration. See CallbackFunc for details.