Files
gocqlx/migrate/README.md
Michał Matczuk d25129e2fc migrate: Add support CQL comment callbacks
This patch adds a new migration event type CallComment that it triggered by adding `-- CALL <name>;` comment in a CQL file.

Fixes #101
2020-12-03 13:37:56 +01:00

35 lines
808 B
Markdown

# 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 `gocqlx.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
```go
package main
import (
"context"
"github.com/scylladb/gocqlx/v2/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)
}
}
```