Files
gocqlx/migrate
Daniel Lohse ed4fad9742 Add DefaultAwaitSchemaAgreement option (disabled by default)
Depending on what is set, schema agreement is checked before each file or before each statement.
Awaiting schema agreement after every migration has run is always done.
2020-02-05 15:23:06 +01:00
..
2017-09-22 14:05:26 +02:00
2018-05-23 16:02:40 +02:00
2017-09-22 14:05:26 +02:00
2019-11-07 16:13:50 -08:00
2018-05-25 14:20:59 +02:00
2018-05-25 14:20:59 +02:00

GoCQLX Migrations

Package migrate provides simple and flexible CQL 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.

Features

  • Each CQL statement will run once
  • Go code migrations using callbacks

Example

package main

import (
    "context"

    "github.com/scylladb/gocqlx/migrate"
)

const dir = "./cql" 

func main() {
    session := CreateSession()
    defer session.Close()

    ctx := context.Background()
    if err := migrate.Migrate(ctx, session, dir); err != nil {
        panic(err)
    }
}