Documentation ¶
Overview ¶
Package sqltool contains logic to integrate existing tools like Flyway or Liquibase with the Atlas CLI.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // GolangMigrateFormatter is a migrate.Formatter compatible with golang-migrate/migrate. GolangMigrateFormatter = templateFormatter( "{{ now }}{{ with .Name }}_{{ . }}{{ end }}.up.sql", `{{ range .Changes }}{{ with .Comment }}-- {{ println . }}{{ end }}{{ printf "%s;\n" .Cmd }}{{ end }}`, "{{ now }}{{ with .Name }}_{{ . }}{{ end }}.down.sql", `{{ range rev .Changes }}{{ if .Reverse }}{{ with .Comment }}-- reverse: {{ println . }}{{ end }}{{ printf "%s;\n" .Reverse }}{{ end }}{{ end }}`, ) // GooseFormatter returns a migrate.Formatter compatible with pressly/goose. GooseFormatter = templateFormatter( "{{ now }}{{ with .Name }}_{{ . }}{{ end }}.sql", `-- +goose Up {{ range .Changes }}{{ with .Comment }}-- {{ println . }}{{ end }}{{ printf "%s;\n" .Cmd }}{{ end }} -- +goose Down {{ range rev .Changes }}{{ if .Reverse }}{{ with .Comment }}-- reverse: {{ println . }}{{ end }}{{ printf "%s;\n" .Reverse }}{{ end }}{{ end }}`, ) // FlywayFormatter returns a migrate.Formatter compatible with Flyway. FlywayFormatter = templateFormatter( "V{{ now }}{{ with .Name }}__{{ . }}{{ end }}.sql", `{{ range .Changes }}{{ with .Comment }}-- {{ println . }}{{ end }}{{ printf "%s;\n" .Cmd }}{{ end }}`, "U{{ now }}{{ with .Name }}__{{ . }}{{ end }}.sql", `{{ range rev .Changes }}{{ if .Reverse }}{{ with .Comment }}-- reverse: {{ println . }}{{ end }}{{ printf "%s;\n" .Reverse }}{{ end }}{{ end }}`, ) // LiquibaseFormatter returns a migrate.Formatter compatible with Liquibase. LiquibaseFormatter = templateFormatter( "{{ now }}{{ with .Name }}_{{ . }}{{ end }}.sql", `{{- $now := now -}} --liquibase formatted sql {{- range $index, $change := .Changes }} --changeset atlas:{{ $now }}-{{ inc $index }} {{ with $change.Comment }}--comment: {{ . }}{{ end }} {{ $change.Cmd }}; {{ with $change.Reverse }}--rollback: {{ . }};{{ end }} {{ end }}`, ) // DbmateFormatter returns a migrate.Formatter compatible with amacneil/dbmate. DbmateFormatter = templateFormatter( "{{ now }}{{ with .Name }}_{{ . }}{{ end }}.sql", `-- migrate:up {{ range .Changes }}{{ with .Comment }}-- {{ println . }}{{ end }}{{ printf "%s;\n" .Cmd }}{{ end }} -- migrate:down {{ range rev .Changes }}{{ if .Reverse }}{{ with .Comment }}-- reverse: {{ println . }}{{ end }}{{ printf "%s;\n" .Reverse }}{{ end }}{{ end }}`, ) )
Functions ¶
This section is empty.
Types ¶
type GolangMigrateDir ¶ added in v0.4.3
GolangMigrateDir wraps a migrate.LocalDir and provides a migrate.Scanner implementation compatible with golang-migrate/migrate.
func NewGolangMigrateDir ¶ added in v0.4.3
func NewGolangMigrateDir(path string) (*GolangMigrateDir, error)
NewGolangMigrateDir returns a new GolangMigrateDir.
Click to show internal directories.
Click to hide internal directories.