package sqltool
import "ariga.io/atlas/sql/sqltool"
Package sqltool contains logic to integrate existing tools like Flyway or Liquibase with the Atlas CLI.
Index ¶
- Variables
- func SetRepeatableVersion(ff []migrate.File)
- type DBMateDir
- func NewDBMateDir(path string) (*DBMateDir, error)
- func (d *DBMateDir) Files() ([]migrate.File, error)
- type DBMateFile
- func (f *DBMateFile) StmtDecls() ([]*migrate.Stmt, error)
- func (f *DBMateFile) Stmts() ([]string, error)
- type FlywayDir
- func NewFlywayDir(path string) (*FlywayDir, error)
- func (d *FlywayDir) Checksum() (migrate.HashFile, error)
- func (d *FlywayDir) Files() ([]migrate.File, error)
- func (d *FlywayDir) Path() string
- func (d *FlywayDir) WriteFile(name string, b []byte) error
- type FlywayFile
- type GolangMigrateDir
- func NewGolangMigrateDir(path string) (*GolangMigrateDir, error)
- func (d *GolangMigrateDir) Checksum() (migrate.HashFile, error)
- func (d *GolangMigrateDir) Files() ([]migrate.File, error)
- func (d *GolangMigrateDir) Path() string
- func (d *GolangMigrateDir) WriteFile(name string, b []byte) error
- type GolangMigrateFile
- type GooseDir
- type GooseFile
- func (f *GooseFile) StmtDecls() ([]*migrate.Stmt, error)
- func (f *GooseFile) Stmts() ([]string, error)
- type LiquibaseDir
Variables ¶
var ( 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", "" /* 190 byte string literal not displayed */, ) GooseFormatter = templateFormatter( "{{ now }}{{ with .Name }}_{{ . }}{{ end }}.sql", "" /* 319 byte string literal not displayed */, ) 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", "" /* 190 byte string literal not displayed */, ) LiquibaseFormatter = templateFormatter( "{{ now }}{{ with .Name }}_{{ . }}{{ end }}.sql", "" /* 324 byte string literal not displayed */, ) DBMateFormatter = templateFormatter( "{{ now }}{{ with .Name }}_{{ . }}{{ end }}.sql", "" /* 321 byte string literal not displayed */, ) DbmateFormatter = DBMateFormatter )
Functions ¶
func SetRepeatableVersion ¶
SetRepeatableVersion iterates over the migration files and assigns repeatable migrations a version number since Atlas does not have the concept of repeatable migrations. Each repeatable migration file gets assigned the version of the preceding migration file (or 0) followed by an 'R'.
Types ¶
type DBMateDir ¶
DBMateDir wraps migrate.LocalDir and provides a migrate.Scanner implementation able to understand files generated by the DBMateFormatter for migration directory replaying.
func NewDBMateDir ¶
NewDBMateDir returns a new DBMateDir.
func (*DBMateDir) Files ¶
Files looks for all files with up.sql suffix and orders them by filename.
type DBMateFile ¶
DBMateFile wraps migrate.LocalFile with custom statements function.
func (*DBMateFile) StmtDecls ¶
func (f *DBMateFile) StmtDecls() ([]*migrate.Stmt, error)
StmtDecls understands the migration format used by amacneil/dbmate sql migration files.
func (*DBMateFile) Stmts ¶
func (f *DBMateFile) Stmts() ([]string, error)
Stmts understands the migration format used by amacneil/dbmate sql migration files.
type FlywayDir ¶
FlywayDir wraps fs.FS and provides a migrate.Scanner implementation able to understand files generated by the FlywayFormatter for migration directory replaying.
func NewFlywayDir ¶
NewFlywayDir returns a new FlywayDir.
func (*FlywayDir) Checksum ¶
Checksum implements Dir.Checksum. By default, it calls Files() and creates a checksum from them.
func (*FlywayDir) Files ¶
Files implements Scanner.Files. It looks for all files with .sql suffix. The given directory is recursively scanned for non-hidden subdirectories. All found files will be ordered by migration type (Baseline, Versioned, Repeatable) and filename.
func (*FlywayDir) Path ¶
Path returns the local path used for opening this dir.
func (*FlywayDir) WriteFile ¶
WriteFile implements Dir.WriteFile.
type FlywayFile ¶
FlywayFile wraps migrate.LocalFile with custom statements function.
func (FlywayFile) Desc ¶
func (f FlywayFile) Desc() string
Desc implements File.Desc.
func (FlywayFile) Version ¶
func (f FlywayFile) Version() string
Version implements File.Version.
type GolangMigrateDir ¶
GolangMigrateDir wraps fs.FS and provides a migrate.Scanner implementation able to understand files generated by the GolangMigrateFormatter for migration directory replaying.
func NewGolangMigrateDir ¶
func NewGolangMigrateDir(path string) (*GolangMigrateDir, error)
NewGolangMigrateDir returns a new GolangMigrateDir.
func (*GolangMigrateDir) Checksum ¶
func (d *GolangMigrateDir) Checksum() (migrate.HashFile, error)
Checksum implements Dir.Checksum. By default, it calls Files() and creates a checksum from them.
func (*GolangMigrateDir) Files ¶
func (d *GolangMigrateDir) Files() ([]migrate.File, error)
Files implements Scanner.Files. It looks for all files with up.sql suffix and orders them by filename.
func (*GolangMigrateDir) Path ¶
func (d *GolangMigrateDir) Path() string
Path returns the local path used for opening this dir.
func (*GolangMigrateDir) WriteFile ¶
func (d *GolangMigrateDir) WriteFile(name string, b []byte) error
WriteFile implements Dir.WriteFile.
type GolangMigrateFile ¶
GolangMigrateFile wraps migrate.LocalFile with custom description function.
func (*GolangMigrateFile) Desc ¶
func (f *GolangMigrateFile) Desc() string
Desc implements File.Desc.
type GooseDir ¶
GooseDir wraps migrate.LocalDir and provides a migrate.Scanner implementation able to understand files generated by the GooseFormatter for migration directory replaying.
func NewGooseDir ¶
NewGooseDir returns a new GooseDir.
func (*GooseDir) Files ¶
Files looks for all files with .sql suffix and orders them by filename.
type GooseFile ¶
GooseFile wraps migrate.LocalFile with custom statements function.
func (*GooseFile) StmtDecls ¶
StmtDecls understands the migration format used by pressly/goose sql migration files.
func (*GooseFile) Stmts ¶
Stmts understands the migration format used by pressly/goose sql migration files.
type LiquibaseDir ¶
LiquibaseDir wraps migrate.LocalDir and provides a migrate.Scanner implementation able to understand files generated by the LiquibaseFormatter for migration directory replaying.
func NewLiquibaseDir ¶
func NewLiquibaseDir(path string) (*LiquibaseDir, error)
NewLiquibaseDir returns a new LiquibaseDir.
Source Files ¶
doc.go hidden.go tool.go
- Version
- v0.32.0 (latest)
- Published
- Mar 10, 2025
- Platform
- linux/amd64
- Imports
- 15 packages
- Last checked
- 1 month ago –
Tools for package owners.