File tree Expand file tree Collapse file tree 1 file changed +11
-18
lines changed Expand file tree Collapse file tree 1 file changed +11
-18
lines changed Original file line number Diff line number Diff line change 1
1
package migration
2
2
3
3
import (
4
- "errors "
4
+ "context "
5
5
6
+ "github.com/pkg/errors"
6
7
"github.com/vim-volt/volt/config"
8
+ "github.com/vim-volt/volt/dsl"
9
+ "github.com/vim-volt/volt/dsl/dslctx"
10
+ "github.com/vim-volt/volt/dsl/ops"
7
11
"github.com/vim-volt/volt/lockjson"
8
- "github.com/vim-volt/volt/transaction"
9
12
)
10
13
11
14
func init () {
@@ -32,22 +35,12 @@ Description
32
35
To suppress this, running this command simply reads and writes migrated structure to lock.json.`
33
36
}
34
37
35
- func (* lockjsonMigrater ) Migrate (lockJSON * lockjson.LockJSON , cfg * config.Config ) ( result error ) {
36
- // Begin transaction
37
- trx , err := transaction . Start ()
38
+ func (* lockjsonMigrater ) Migrate (lockJSON * lockjson.LockJSON , cfg * config.Config ) error {
39
+ ctx := dslctx . WithDSLValues ( context . Background (), lockJSON , cfg )
40
+ expr , err := ops . LockJSONWriteOp . Bind ()
38
41
if err != nil {
39
- return err
42
+ return errors . Wrapf ( err , "cannot bind %s operator" , ops . LockJSONWriteOp . String ())
40
43
}
41
- defer func () {
42
- if err := trx .Done (); err != nil {
43
- result = err
44
- }
45
- }()
46
-
47
- // Write to lock.json
48
- err = lockJSON .Write ()
49
- if err != nil {
50
- return errors .New ("could not write to lock.json: " + err .Error ())
51
- }
52
- return nil
44
+ _ , err = dsl .Execute (ctx , expr )
45
+ return err
53
46
}
You can’t perform that action at this time.
0 commit comments