mirror of https://github.com/status-im/migrate.git
List source and database drivers in help text
This commit is contained in:
parent
0d9f636356
commit
c4e855b58c
|
@ -11,6 +11,8 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/golang-migrate/migrate"
|
||||
"github.com/golang-migrate/migrate/database"
|
||||
"github.com/golang-migrate/migrate/source"
|
||||
)
|
||||
|
||||
// set main log
|
||||
|
@ -52,7 +54,9 @@ Commands:
|
|||
drop Drop everyting inside database
|
||||
force V Set version V but don't run migration (ignores dirty state)
|
||||
version Print current migration version
|
||||
`)
|
||||
|
||||
Source drivers: `+strings.Join(source.List(), ", ")+`
|
||||
Database drivers: `+strings.Join(database.List(), ", ")+"\n")
|
||||
}
|
||||
|
||||
flag.Parse()
|
||||
|
|
|
@ -110,3 +110,14 @@ func Register(name string, driver Driver) {
|
|||
}
|
||||
drivers[name] = driver
|
||||
}
|
||||
|
||||
// List lists the registered drivers
|
||||
func List() []string {
|
||||
driversMu.RLock()
|
||||
defer driversMu.RUnlock()
|
||||
names := make([]string, 0, len(drivers))
|
||||
for n := range drivers {
|
||||
names = append(names, n)
|
||||
}
|
||||
return names
|
||||
}
|
||||
|
|
|
@ -105,3 +105,14 @@ func Register(name string, driver Driver) {
|
|||
}
|
||||
drivers[name] = driver
|
||||
}
|
||||
|
||||
// List lists the registered drivers
|
||||
func List() []string {
|
||||
driversMu.RLock()
|
||||
defer driversMu.RUnlock()
|
||||
names := make([]string, 0, len(drivers))
|
||||
for n := range drivers {
|
||||
names = append(names, n)
|
||||
}
|
||||
return names
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue