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 {
4949 }
5050}
5151
52- func (this * Applier ) setOptimizerSwitch (tx * gosql. Tx ) error {
52+ func (this * Applier ) setOptimizerSwitch () error {
5353 if this .migrationContext .OptimizerSwitch == "" {
5454 return nil
5555 }
5656 optimizerString := fmt .Sprintf ("SET SESSION optimizer_switch=%q" , this .migrationContext .OptimizerSwitch )
57- _ , err := tx .Query (optimizerString )
57+ _ , err := this . db .Query (optimizerString )
5858 return err
5959}
6060
@@ -109,6 +109,10 @@ func (this *Applier) InitDBConnections() (err error) {
109109 this .connectionConfig .ImpliedKey = impliedKey
110110 }
111111 }
112+ err = this .setOptimizerSwitch ()
113+ if err != nil {
114+ return err
115+ }
112116 if err := this .readTableColumns (); err != nil {
113117 return err
114118 }
@@ -556,11 +560,6 @@ func (this *Applier) ReadMigrationRangeValues() error {
556560 }
557561 defer tx .Rollback ()
558562
559- err = this .setOptimizerSwitch (tx )
560- if err != nil {
561- return err
562- }
563-
564563 if err := this .readMigrationMinValues (tx , this .migrationContext .UniqueKey ); err != nil {
565564 return err
566565 }
You can’t perform that action at this time.
0 commit comments