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 }}`, ) )
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.