File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed
lib/internal/Magento/Framework/Setup
Test/Unit/Declaration/Schema Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -132,10 +132,10 @@ public function getDestructiveOperations()
132
132
private function startSetupForAllConnections ()
133
133
{
134
134
foreach ($ this ->sharding ->getResources () as $ resource ) {
135
- $ this ->resourceConnection ->getConnection ($ resource )
136
- -> startSetup ();
137
- $ this -> resourceConnection -> getConnection ( $ resource )
138
- ->query ('SET UNIQUE_CHECKS=0 ' );
135
+ $ connection = $ this ->resourceConnection ->getConnection ($ resource );
136
+
137
+ $ connection -> startSetup ();
138
+ $ connection ->query ('SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 ' );
139
139
}
140
140
}
141
141
@@ -148,8 +148,10 @@ private function startSetupForAllConnections()
148
148
private function endSetupForAllConnections ()
149
149
{
150
150
foreach ($ this ->sharding ->getResources () as $ resource ) {
151
- $ this ->resourceConnection ->getConnection ($ resource )
152
- ->endSetup ();
151
+ $ connection = $ this ->resourceConnection ->getConnection ($ resource );
152
+
153
+ $ connection ->query ('SET UNIQUE_CHECKS=IF(@OLD_UNIQUE_CHECKS=0, 0, 1) ' );
154
+ $ connection ->endSetup ();
153
155
}
154
156
}
155
157
Original file line number Diff line number Diff line change @@ -160,7 +160,7 @@ public function testExecute()
160
160
$ connectionMock = $ this ->getMockBuilder (Mysql::class)
161
161
->disableOriginalConstructor ()
162
162
->getMock ();
163
- $ this ->resourceConnectionMock ->expects (self ::exactly (3 ))
163
+ $ this ->resourceConnectionMock ->expects (self ::exactly (2 ))
164
164
->method ('getConnection ' )
165
165
->with ('default ' )
166
166
->willReturn ($ connectionMock );
You can’t perform that action at this time.
0 commit comments