mirror of
https://github.com/status-im/migrate.git
synced 2025-02-23 08:18:07 +00:00
add bash driver again
This commit is contained in:
parent
b3835d4bde
commit
b545420127
7
driver/bash/README.md
Normal file
7
driver/bash/README.md
Normal file
@ -0,0 +1,7 @@
|
||||
# Bash Driver
|
||||
|
||||
```
|
||||
-url="bash://"
|
||||
```
|
||||
|
||||
### @TODO
|
26
driver/bash/bash.go
Normal file
26
driver/bash/bash.go
Normal file
@ -0,0 +1,26 @@
|
||||
package bash
|
||||
|
||||
import (
|
||||
"github.com/mattes/migrate/file"
|
||||
_ "github.com/mattes/migrate/migrate/direction"
|
||||
)
|
||||
|
||||
type Driver struct {
|
||||
}
|
||||
|
||||
func (driver *Driver) Initialize(url string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (driver *Driver) FilenameExtension() string {
|
||||
return "sh"
|
||||
}
|
||||
|
||||
func (driver *Driver) Migrate(files file.Files, pipe chan interface{}) {
|
||||
defer close(pipe)
|
||||
return
|
||||
}
|
||||
|
||||
func (driver *Driver) Version() (uint64, error) {
|
||||
return uint64(0), nil
|
||||
}
|
9
driver/bash/bash_test.go
Normal file
9
driver/bash/bash_test.go
Normal file
@ -0,0 +1,9 @@
|
||||
package bash
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestFoobar(t *testing.T) {
|
||||
|
||||
}
|
@ -3,7 +3,7 @@ package driver
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
// "github.com/mattes/migrate/driver/bash"
|
||||
"github.com/mattes/migrate/driver/bash"
|
||||
"github.com/mattes/migrate/driver/postgres"
|
||||
"github.com/mattes/migrate/file"
|
||||
neturl "net/url" // alias to allow `url string` func signature in New
|
||||
@ -31,13 +31,13 @@ func New(url string) (Driver, error) {
|
||||
return nil, err
|
||||
}
|
||||
return d, nil
|
||||
// case "bash":
|
||||
// d := &bash.Driver{}
|
||||
// verifyFilenameExtension("bash", d)
|
||||
// if err := d.Initialize(url); err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
// return d, nil
|
||||
case "bash":
|
||||
d := &bash.Driver{}
|
||||
verifyFilenameExtension("bash", d)
|
||||
if err := d.Initialize(url); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return d, nil
|
||||
default:
|
||||
return nil, errors.New(fmt.Sprintf("Driver '%s' not found.", u.Scheme))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user