File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -49,12 +49,12 @@ func newDmlBuildResultError(err error) *dmlBuildResult {
49
49
}
50
50
}
51
51
52
- func (this * Applier ) setOptimizerSwitch (tx * gosql. Tx ) error {
52
+ func (this * Applier ) setOptimizerSwitch () error {
53
53
if this .migrationContext .OptimizerSwitch == "" {
54
54
return nil
55
55
}
56
56
optimizerString := fmt .Sprintf ("SET SESSION optimizer_switch=%q" , this .migrationContext .OptimizerSwitch )
57
- _ , err := tx .Query (optimizerString )
57
+ _ , err := this . db .Query (optimizerString )
58
58
return err
59
59
}
60
60
@@ -109,6 +109,10 @@ func (this *Applier) InitDBConnections() (err error) {
109
109
this .connectionConfig .ImpliedKey = impliedKey
110
110
}
111
111
}
112
+ err = this .setOptimizerSwitch ()
113
+ if err != nil {
114
+ return err
115
+ }
112
116
if err := this .readTableColumns (); err != nil {
113
117
return err
114
118
}
@@ -556,11 +560,6 @@ func (this *Applier) ReadMigrationRangeValues() error {
556
560
}
557
561
defer tx .Rollback ()
558
562
559
- err = this .setOptimizerSwitch (tx )
560
- if err != nil {
561
- return err
562
- }
563
-
564
563
if err := this .readMigrationMinValues (tx , this .migrationContext .UniqueKey ); err != nil {
565
564
return err
566
565
}
You can’t perform that action at this time.
0 commit comments