mirror of https://github.com/status-im/migrate.git
parent
144aaaa986
commit
46fb82ce3d
|
@ -160,7 +160,6 @@ func (ch *ClickHouse) SetVersion(version int, dirty bool) error {
|
||||||
return tx.Commit()
|
return tx.Commit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ensureVersionTable checks if versions table exists and, if not, creates it.
|
// ensureVersionTable checks if versions table exists and, if not, creates it.
|
||||||
// Note that this function locks the database, which deviates from the usual
|
// Note that this function locks the database, which deviates from the usual
|
||||||
// convention of "caller locks" in the ClickHouse type.
|
// convention of "caller locks" in the ClickHouse type.
|
||||||
|
|
|
@ -61,6 +61,7 @@ func WithInstance(instance *sql.DB, config *Config) (database.Driver, error) {
|
||||||
}
|
}
|
||||||
return mx, nil
|
return mx, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ensureVersionTable checks if versions table exists and, if not, creates it.
|
// ensureVersionTable checks if versions table exists and, if not, creates it.
|
||||||
// Note that this function locks the database, which deviates from the usual
|
// Note that this function locks the database, which deviates from the usual
|
||||||
// convention of "caller locks" in the Ql type.
|
// convention of "caller locks" in the Ql type.
|
||||||
|
|
|
@ -36,4 +36,4 @@ func TestMigrateUp(t *testing.T, m *migrate.Migrate) {
|
||||||
if err := m.Up(); err != nil {
|
if err := m.Up(); err != nil {
|
||||||
t.Fatalf("%v", err)
|
t.Fatalf("%v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ Commands:
|
||||||
goto V Migrate to version V
|
goto V Migrate to version V
|
||||||
up [N] Apply all or N up migrations
|
up [N] Apply all or N up migrations
|
||||||
down [N] Apply all or N down migrations
|
down [N] Apply all or N down migrations
|
||||||
drop Drop everyting inside database
|
drop Drop everything inside database
|
||||||
force V Set version V but don't run migration (ignores dirty state)
|
force V Set version V but don't run migration (ignores dirty state)
|
||||||
version Print current migration version
|
version Print current migration version
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Package vfs contains a driver that reads migrations from a virtual file
|
// Package godoc_vfs contains a driver that reads migrations from a virtual file
|
||||||
// system.
|
// system.
|
||||||
//
|
//
|
||||||
// Implementations of the filesystem interface that read from zip files and
|
// Implementations of the filesystem interface that read from zip files and
|
||||||
|
|
|
@ -67,7 +67,7 @@ func (i *Migrations) Append(m *Migration) (ok bool) {
|
||||||
|
|
||||||
func (i *Migrations) buildIndex() {
|
func (i *Migrations) buildIndex() {
|
||||||
i.index = make(uintSlice, 0)
|
i.index = make(uintSlice, 0)
|
||||||
for version, _ := range i.migrations {
|
for version := range i.migrations {
|
||||||
i.index = append(i.index, version)
|
i.index = append(i.index, version)
|
||||||
}
|
}
|
||||||
sort.Sort(i.index)
|
sort.Sort(i.index)
|
||||||
|
|
2
util.go
2
util.go
|
@ -23,7 +23,7 @@ func NewMultiError(errs ...error) MultiError {
|
||||||
return MultiError{compactErrs}
|
return MultiError{compactErrs}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Error implements error. Mulitple errors are concatenated with 'and's.
|
// Error implements error. Multiple errors are concatenated with 'and's.
|
||||||
func (m MultiError) Error() string {
|
func (m MultiError) Error() string {
|
||||||
var strs = make([]string, 0)
|
var strs = make([]string, 0)
|
||||||
for _, e := range m.Errs {
|
for _, e := range m.Errs {
|
||||||
|
|
Loading…
Reference in New Issue